Sagemath Jupyter Kernel install error after conda-forge installation - jupyter

So I've installed SageMath through anaconda with conda install sage python jupyterlab.
I then go to install the sage jupyter kernel as in this thread via jupyter kernelspec install --user ~/miniconda3/envs/sage/share/jupyter/kernels/sagemath
But this command fails with the following error
Traceback (most recent call last):
File "/Users/llamagod/miniconda3/envs/sage/bin/jupyter-kernelspec", line 10, in <module>
sys.exit(KernelSpecApp.launch_instance())
File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
app.start()
File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/site-packages/jupyter_client/kernelspecapp.py", line 266, in start
return self.subapp.start()
File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/site-packages/jupyter_client/kernelspecapp.py", line 132, in start
self.kernel_spec_manager.install_kernel_spec(self.sourcedir,
File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/site-packages/jupyter_client/kernelspec.py", line 340, in install_kernel_spec
shutil.copytree(source_dir, destination)
File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/shutil.py", line 557, in copytree
return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/shutil.py", line 513, in _copytree
raise Error(errors)
shutil.Error: [('/Users/llamagod/miniconda3/envs/sage/share/jupyter/kernels/sagemath/doc', '/Users/llamagod/Library/Jupyter/kernels/sagemath/doc', "[Errno 2] No such file or directory: '/Users/llamagod/miniconda3/envs/sage/share/jupyter/kernels/sagemath/doc'")]
I tried symlinking $SAGE_LOCAL/share/doc to that directory but I get the same error.
SageMath 9.2, JupyterLab 3.0.16
Is this a known issue ?

In the end I used the alternate method described on this page to install the kernel and avoid copying over the documentation.
ln -s `sage -sh -c 'ls -d $SAGE_LOCAL/share/jupyter/kernels/sagemath'` $HOME/miniconda3/envs/sage/share/jupyter
So I can now run the sagemath kernel from the jupyter in my conda environment.

Related

Operator framework ansible install psycopg2-binary

How do I install psycopg2-binary in Operator Framework Ansible? I've tried adding a RUN pip3 install psycopg2-binary to the Dockerfile but that returns:
Installing collected packages: psycopg2-binary
Exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main
status = self.run(options, args)
File "/usr/lib/python3.6/site-packages/pip/commands/install.py", line 365, in run
strip_file_prefix=options.strip_file_prefix,
File "/usr/lib/python3.6/site-packages/pip/req/req_set.py", line 789, in install
**kwargs
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 854, in install
strip_file_prefix=strip_file_prefix
File "/usr/lib/python3.6/site-packages/pip/req/req_install.py", line 1069, in move_wheel_files
strip_file_prefix=strip_file_prefix,
File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files
clobber(source, lib_dir, True)
File "/usr/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber
ensure_dir(destdir)
File "/usr/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir
os.makedirs(path)
File "/usr/lib64/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/usr/local/lib64/python3.6/site-packages/psycopg2'
PS. I couldn't add Operator-Framework tag because I need 130 more points to be able to ;)
I've found the origin of the Dockerfile and that helped me come up with this:
COPY requirements.txt ${HOME}/requirements.txt
USER root
RUN pip3 install -r ${HOME}/requirements.txt
USER ${USER_UID}

Error installing AutoitLibrary through command line

I need to install robotframework-autoitlibrary to use on my test cases.
My problem is when I try to install AutoIt Library through command line with the following command:
pip install -U robotframework-autoitlibrary --no-cache-dir --pre
I have this error:
C:\windows\system32>pip install -U robotframework-autoitlibrary --no-cache-
dir --pre
Collecting robotframework-autoitlibrary
Downloading
https://files.pythonhosted.org/packages/4e/a4/9e51fe35b1da7a006b773c9c234f78e89bcc4f267152c4e9fa8260631fa8/robotframework-autoitlibrary-1.2.2.zip (701kB)
100% |################################| 706kB 1.6MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "c:\users\user-a~1\appdata\local\temp\pip-install-
oro1ov\robotframework-autoitlibrary\setup.py", line 93, in <module>
destPath = os.path.normpath(os.path.join(os.getenv("HOMEDRIVE"),
r"\RobotFramework\Extensions\AutoItLibrary"))
File "c:\python27\lib\ntpath.py", line 65, in join
result_drive, result_path = splitdrive(path)
File "c:\python27\lib\ntpath.py", line 115, in splitdrive
if len(p) > 1:
TypeError: object of type 'NoneType' has no len()
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
c:\users\user-a~1\appdata\local\temp\pip-install-oro1ov\robotframework-
autoitlibrary\
My currently installed python packages and their versions are:
Pillow==5.3.0
Pygments==2.3.1
pypiwin32==223
Pypubsub==4.0.0
pywin32==224
robotframework==3.1
robotframework-ride==1.5.2.1
robotframework-selenium2library==3.0.0
robotframework-seleniumlibrary==3.3.0
selenium==3.141.0
six==1.12.0
typing==3.6.6
urllib3==1.24.1
wxPython==4.0.3
I already try this command:
pip install --upgrade setuptools
When input echo %HOMEDRIVE%, the output is:
C:\Users\cmpeixoto>echo %HOMEDRIVE%
C:
Thanks for your help,
The error looks like the environment variable HOMEDRIVE is not set, even though it has a value according to your test (the library installer uses it to copy some files).
Can you try this - manually set it, and straight after that run the pip - in the same Command Prompt (cmd) session:
set HOMEDRIVE=C:
pip install -U robotframework-autoitlibrary --no-cache-dir --pre

Installing awscli without internet

I am trying to install awscli on a RHEL machine.
Python 2.7.5 is installed, the machine does not have internet access.
I have installed setuptools 38.5.2 and setuptools_scm 1.15.7 from sources successfully.
Here is the command I have tried to run when installing:
sudo /usr/bin/python2.7 awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws sudo awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Both are exiting with the following issue:
Running cmd: /usr/bin/python virtualenv.py --no-download --python /usr/bin/python /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install --no-index --find-links file:///home/talendmaster/QlikSensePOC/awscli-bundle/packages awscli-1.14.54.tar.gz
Traceback (most recent call last):
File "awscli-bundle/install", line 143, in <module>
main()
File "awscli-bundle/install", line 132, in main
pip_install_packages(opts.install_dir)
File "awscli-bundle/install", line 100, in pip_install_packages
pip_script, PACKAGES_DIR, cli_tarball))
File "awscli-bundle/install", line 45, in run
p.returncode, cmd, stdout + stderr))
__main__.BadRCError: Bad rc (1) for cmd '/usr/local/aws/bin/pip install --no-index --find-links file:///home/talendmaster/QlikSensePOC/awscli-bundle/packages awscli-1.14.54.tar.gz': Processing ./awscli-1.14.54.tar.gz
Collecting botocore==1.9.7 (from awscli==1.14.54)
Collecting colorama<=0.3.7,>=0.2.5 (from awscli==1.14.54)
Collecting docutils>=0.10 (from awscli==1.14.54)
Collecting rsa<=3.5.0,>=3.1.2 (from awscli==1.14.54)
Collecting s3transfer<0.2.0,>=0.1.12 (from awscli==1.14.54)
Collecting PyYAML<=3.12,>=3.10 (from awscli==1.14.54)
Collecting jmespath<1.0.0,>=0.7.1 (from botocore==1.9.7->awscli==1.14.54)
Collecting python-dateutil<3.0.0,>=2.1 (from botocore==1.9.7->awscli==1.14.54)
Complete output from command python setup.py egg_info:
Download error on https://pypi.python.org/simple/setuptools_scm/: [Errno 101] Network is unreachable -- Some packages may not be found!
Download error on https://pypi.python.org/simple/setuptools-scm/: [Errno 101] Network is unreachable -- Some packages may not be found!
Couldn't find index page for 'setuptools_scm' (maybe misspelled?)
Download error on https://pypi.python.org/simple/: [Errno 101] Network is unreachable -- Some packages may not be found!
No local packages or working download links found for setuptools_scm
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-kh_Hg9/python-dateutil/setup.py", line 67, in <module>
"test": Unsupported
File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup
_setup_distribution = dist = klass(attrs)
File "/usr/local/aws/lib/python2.7/site-packages/setuptools/dist.py", line 315, in __init__
self.fetch_build_eggs(attrs['setup_requires'])
File "/usr/local/aws/lib/python2.7/site-packages/setuptools/dist.py", line 361, in fetch_build_eggs
replace_conflicting=True,
File "/usr/local/aws/lib/python2.7/site-packages/pkg_resources/__init__.py", line 850, in resolve
dist = best[req.key] = env.best_match(req, ws, installer)
File "/usr/local/aws/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1122, in best_match
return self.obtain(req, installer)
File "/usr/local/aws/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1134, in obtain
return installer(requirement)
File "/usr/local/aws/lib/python2.7/site-packages/setuptools/dist.py", line 429, in fetch_build_egg
return cmd.easy_install(req)
File "/usr/local/aws/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 659, in easy_install
raise DistutilsError(msg)
distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('setuptools_scm')
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-kh_Hg9/python-dateutil/
It seems to be related to setuptools_scm but reinstallation did not change anything. The internet access shouldn't be a problem since I have successfully installed a local version of the package.
I have just finished installing AWS CLI tools on an old RHEL 5.10 machine, this works for me as on date.
$ curl -LO https://s3.amazonaws.com/aws-cli/awscli-bundle.zip
$ unzip awscli-bundle.zip
$ ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Running cmd: /root/aws/bin/python virtualenv.py --no-download --python /root/aws/bin/python /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install --no-index --find-links file:///root/awscli-bundle/packages/setup setuptools_scm-1.15.7.tar.gz
Running cmd: /usr/local/aws/bin/pip install --no-index --find-links file:///root/awscli-bundle/packages awscli-1.15.68.tar.gz
You can now run: /usr/local/bin/aws --version
$ aws --version
aws-cli/1.15.68 Python/2.6.8 Linux/2.6.18-363.el5 botocore/1.10.67
References:
https://medium.com/#vikas027/aws-cli-tools-in-rhel-centos-5-cd4b9beeb096 (my post)
https://docs.aws.amazon.com/cli/latest/userguide/awscli-install-bundle.html#install-bundle-other

I am using jupyter notebook, ipython 3 on windows. Whenever i am starting my python 3, i get the "Kernel Dead" message

Dead kernel
The kernel has died, and the automatic restart has failed. It is possible the kernel cannot be restarted.
If you are not able to restart the kernel, you will still be able to save the notebook, but running code will no longer work until the notebook is reopened.
the above message is shown in notebook dashboard after i start python3.
[I 23:07:08.365 NotebookApp] KernelRestarter: restarting kernel (4/5)
WARNING:root:kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb restarted
Traceback (most recent call last):
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\runpy.py"
, line 170, in _run_module_as_main
"__main__", mod_spec)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\runpy.py"
, line 85, in _run_code
exec(code, run_globals)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\__main__.py", line 3, in <module>
app.launch_new_instance()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\traitlets\config\application.py", line 588, in launch_instance
app.initialize(argv)
File "<decorator-gen-123>", line 2, in initialize
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\traitlets\config\application.py", line 74, in catch_config_error
return method(app, *args, **kwargs)
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 417, in initialize
self.init_io()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 316, in init_io
self.patch_io()
File "c:\users\dharini\appdata\local\programs\python\python35-32\lib\site-pack
ages\ipykernel\kernelapp.py", line 326, in patch_io
faulthandler_register = faulthandler.register
AttributeError: module 'faulthandler' has no attribute 'register'
[W 23:07:11.369 NotebookApp] KernelRestarter: restart failed
[W 23:07:11.369 NotebookApp] Kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb died, r
emoving from map.
ERROR:root:kernel 9938cea3-6528-4a27-b4c3-ee906d748bfb restarted failed!
[W 23:07:11.390 NotebookApp] Kernel deleted before session
[W 23:07:11.392 NotebookApp] 410 DELETE /api/sessions/1cca4919-305f-4b4f-acdd-b2
a614fd2638 (::1) 3.00ms referer=http://localhost:8888/notebooks/Untitled.ipynb?k
ernel_name=python3
In command prompt i get the above shown message. What is the problem in the faulthandler module. How should I rectify it? I installed jupyter notebook by using "pip". I am new to python programming and also jupyter. please help me resolve this.
We accidentally made a release of the ipykernel package which doesn't work on Python 3.5 on Windows. Once we realised this, we made a new release (version 4.3.1) to fix it.
You can upgrade by running:
pip install --upgrade ipykernel
If you had installed ipykernel using conda, the command would be:
conda update ipykernel

Ansible error due to GMP package version on Centos6

I have a Dockerfile that builds an image based on CentOS (tag: centos6):
FROM centos
RUN rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
RUN yum update -y
RUN yum install ansible -y
ADD ./ansible /home/root/ansible
RUN cd /home/root/ansible;ansible-playbook -v -i hosts site.yml
Everything works fine until Docker hits the last line, then I get the following errors:
[WARNING]: The version of gmp you have installed has a known issue regarding
timing vulnerabilities when used with pycrypto. If possible, you should update
it (ie. yum update gmp).
PLAY [all] ********************************************************************
GATHERING FACTS ***************************************************************
Traceback (most recent call last):
File "/usr/bin/ansible-playbook", line 317, in <module>
sys.exit(main(sys.argv[1:]))
File "/usr/bin/ansible-playbook", line 257, in main
pb.run()
File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 319, in run
if not self._run_play(play):
File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 620, in _run_play
self._do_setup_step(play)
File "/usr/lib/python2.6/site-packages/ansible/playbook/__init__.py", line 565, in _do_setup_step
accelerate_port=play.accelerate_port,
File "/usr/lib/python2.6/site-packages/ansible/runner/__init__.py", line 204, in __init__
cmd = subprocess.Popen(['ssh','-o','ControlPersist'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
File "/usr/lib64/python2.6/subprocess.py", line 642, in __init__
errread, errwrite)
File "/usr/lib64/python2.6/subprocess.py", line 1234, in _execute_child
raise child_exception
OSError: [Errno 2] No such file or directory
Stderr from the command:
package epel-release-6-8.noarch is already installed
I imagine that the cause of the error is the gmp package not being up to date.
There is a related issue on GitHub: https://github.com/ansible/ansible/issues/6941
But there doesn't seem to be any solutions at the moment ...
Any ideas ?
Thanks in advance !
My site.yml playbook:
- hosts: all
pre_tasks:
- shell: echo 'hello'
Make sure that the files site.yml and hosts are present in the directory you're adding to /home/root/ansible.
Side note, you can simplify your Dockerfile by using WORKDIR:
WORKDIR /home/root/ansible
RUN ansible-playbook -v -i hosts site.yml