I've recently just installed Anaconda 3 (for Python 3.4) on a fresh Ubuntu 14.04 installation.
When I go to launch the spyder IDE, I receive following error message:
No module named 'version'
Traceback (most recent call last):
File "/home/daniel/anaconda3/bin/spyder", line 3, in <module>
start_app.main()
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/start_app.py", line 91, in main
from spyderlib import spyder
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/spyder.py", line 158, in <module>
from spyderlib.utils.environ import WinUserEnvDialog
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/utils/environ.py", line 17, in <module>
from spyderlib.widgets.dicteditor import DictEditor
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/widgets/dicteditor.py", line 28, in <module>
from spyderlib.utils.qthelpers import mimedata2url
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/utils/qthelpers.py", line 24, in <module>
from spyderlib.guiconfig import get_shortcut
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/guiconfig.py", line 24, in <module>
from spyderlib.widgets.sourcecode import syntaxhighlighters as sh
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/widgets/sourcecode/syntaxhighlighters.py", line 32, in <module>
required_version=PYGMENTS_REQVER)
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/dependencies.py", line 70, in add
installed_version)]
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/dependencies.py", line 32, in __init__
self.installed_version = programs.get_module_version(modname)
File "/home/daniel/anaconda3/lib/python3.4/site-packages/spyderlib/utils/programs.py", line 218, in get_module_version
mod = __import__(module_name)
File "/home/daniel/qiime_software/sphinx-1.0.4-release/lib/python2.7/site-packages/Pygments-1.6-py2.7.egg/pygments/init.py", line 46
except TypeError, err:
^
SyntaxError: invalid syntax
I installed Conda 3.7 by downloading the .sh file through http://continuum.io/downloads#py34 and then installing it through the terminal with "bash Anaconda3-2.1.0-Linux-x86_64.sh"
What could be the issue?
I may have spotted the issue but still need some help:
When I first made this Ubuntu installation, I put QIIME on here (which is a suite of programs that have been made to work in their own environment for bioinformatics).
I see that in the list of file calls, everything is coming from .../anaconda3/... until the very last line, something is mistakenly (?) called from .../qiime_software/...
I'm assuming this is from both software suites containing python in their PATHs... how may this be fixed? Granted when I check "which python" in the terminal, it (correctly) outputs:
/home/daniel/anaconda3/bin/python
I almost thought a prior question asked here: Anaconda Spyder Qt library error on launch would lead me on the right path but I hit a deadend.
Update:
echo $PYTHONPATH spits out:
/home/daniel/qiime_software/qiime-galaxy-0.0.1-repository-c2814c3c/lib/:/home/daniel/qiime_software/qiime-1.8.0-release/lib/python2.7/site-packages:/home/daniel/qiime_software/qiime-1.8.0-release/lib/:/home/daniel/qiime_software/matplotlib-1.3.1-release/lib/python2.7/site-packages:/home/daniel/qiime_software/pprospector-1.0.1-release/lib/python2.7/site-packages:/home/daniel/qiime_software/tax2tree-1.0-release/lib/python2.7/site-packages:/home/daniel/qiime_software/pynast-1.2.2-release/lib/python2.7/site-packages:/home/daniel/qiime_software/emperor-0.9.3-release/lib/python2.7/site-packages:/home/daniel/qiime_software/pycogent-1.5.3-release/lib/python2.7/site-packages:/home/daniel/qiime_software/biom-format-1.3.1-release/lib/python2.7/site-packages:/home/daniel/qiime_software/ipython-latest-repository-184467d4/lib/python2.7/site-packages:/home/daniel/qiime_software/sphinx-1.0.4-release/lib/python2.7/site-packages:/home/daniel/qiime_software/pyqi-0.3.1-release/lib/python2.7/site-packages:/home/daniel/qiime_software/MySQL-python-1.2.3-release/lib/python2.7/site-packages:/home/daniel/qiime_software/mpi4py-1.2.2-release/lib/python2.7/site-packages:/home/daniel/qiime_software/setuptools-0.6c11-release/lib/python2.7/site-packages:/home/daniel/qiime_software/gdata-2.0.17-release/lib/python2.7/site-packages:/home/daniel/qiime_software/pysqlite-2.6.3-release/lib/python2.7/site-packages:/home/daniel/qiime_software/qcli-0.1.0-release/lib/python2.7/site-packages:/home/daniel/qiime_software/tornado-3.1.1-release/lib/python2.7/site-packages:/home/daniel/qiime_software/SQLAlchemy-0.7.1-release/lib/python2.7/site-packages:/home/daniel/qiime_software/pyzmq-2.1.11-release/lib/python2.7/site-packages:/home/daniel/qiime_software/numpy-1.7.1-release/lib/python2.7/site-packages:
Any help is appreciated.
Python looks up modules in the environment variable PYTHONPATH, so try echo $PYTHONPATH on the shell. Normally, this should be empty.
Otherwise you can try to run spyder from a dedicated environment, so try something like:
$ conda create -n spydertest spyder
$ source activate spydertest
$ spyder
Related
I ran jupyter notebook and I'm getting the following error. Please help!
I checked the conda version, it's working fine. I added paths in the environment variables. I don't know why it isn't working. Previously it worked fine I recently uninstalled it and installed it again.
Traceback (most recent call last):
File "C:\Users\Admin\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Users\Admin\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 51, in <module>
from zmq.eventloop import ioloop
File "C:\Users\Admin\Anaconda3\lib\site-packages\zmq\__init__.py", line 50, in <module>
from zmq import backend
File "C:\Users\Admin\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Users\Admin\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\Admin\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Users\Admin\Anaconda3\lib\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\Admin\Anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed while importing error: The specified module could not be found.
getting this error,
please help!
There can be an issue with the 64bit version of Anaconda, Try these steps:
Install Anaconda 32 Bit for windows.
Add \Anaconda3 and \Anaconda3\Script to Path in Environment variables.
Open Anaconda Prompt and Create an Environment and activate it.
Once you activate the Environment, you will into it. Then write the command JUPYTER
NOTEBOOK, it should run on your Browser.
If that dose not work you can go back and install a bit older version of Anaconda and try doing the same.
Here for more help (:
The problem is:
I cannot launch applications like Spyder, Glueviz, Jupyter Notebook and JupyterLab from Anaconda.
I however can launch VS code but I suspect this is because I already had it previously installed.
However typing "jupyter notebook" or "jupyter lab" on the windows command prompt would launch it well, but this is not using Anaconda. I think this is because I have previously installed jupyter using pip.
First time I installed Anaconda, I checked the add to path option and a while later I had to uninstall it because I couldn't run python applications outside of anaconda. I checked my environment path variables and there are no references to Anaconda in it. So I guess this solution is out of the way.
This time when installing Anaconda, I made sure not to check the add to path option.
Sometimes, I would think this is an installation error, let's uninstall it then reinstall it, but that didn't work. I am using a freshly installed version of Anaconda now and the problem is persisting.
Here is an error that displays when I try to launch Spyder
Traceback (most recent call last):
File "C:\Users\saife\anaconda3\Scripts\spyder-script.py", line 6, in
from spyder.app.start import main
File "C:\Users\saife\anaconda3\lib\site-packages\spyder\app\start.py", line 22, in
import zmq
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\__init__.py", line 47, in
from zmq import backend
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\__init__.py", line 40, in
reraise(*exc_info)
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\__init__.py", line 27, in
_ns = select_backend(first)
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\select.py", line 28, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython\__init__.py", line 6, in
from . import (constants, error, message, context,
ImportError: cannot import name 'constants' from 'zmq.backend.cython' (C:\Users\saife\AppData\Roaming\Python\Python37\site-packages\zmq\backend\cython\__init__.py)
Try this instead of pip, conda install -c anaconda "IDE you want"
I have multiple Python versions installed with pyenv on Ubuntu 16.04. I create virtual environments to work with projects using different versions with pipenv. However, for Python 3.5.x only I get errors like this when I try to edit a file with Vim 8 (installed via the PPA) in an activated virtualenv:
"test.py" 49L, 1434C
Error detected while processing function jedi#init_python[4]..<SNR>48_init_python[27]..jedi#setup_python_imports:
line 25:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/imp.py", line 19, in <module>
from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/importlib/__init__.py", line 57, in <module>
import types
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/types.py", line 166, in <module>
import functools as _functools
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "/home/user/.local/share/virtualenvs/test-AYf6DmHL/lib/python3.5/weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
The issue seems to affect all python related Vim plugins. With other Python versions (e.g. 3.6.x, 3.7.x) this does not occur. What may be causing this issue?
Update: It seems that when I run Vim inside a 3.5.x virtualenv, the Vim's interpreter's sys.path gets updated somehow. For example, this is the output of :py3 import sys; print(sys.path) inside a 3.6.0 virtualenv:
['/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/usr/lib/python3.5/lib-dynload', '/usr/local/lib/python3.5
/dist-packages', '/usr/lib/python3/dist-packages', '_vim_path_']
And this is for 3.5.3:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/imp.py", line 19, in <module>
from importlib._bootstrap import _ERR_MSG, _exec, _load, _builtin_from_name
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/importlib/__init__.py", line 57, in <module>
import types
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/types.py", line 166, in <module>
import functools as _functools
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/functools.py", line 23, in <module>
from weakref import WeakKeyDictionary
File "/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/weakref.py", line 12, in <module>
from _weakref import (
ImportError: cannot import name '_remove_dead_weakref'
['/must>not&exist', '/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python35.zip', '/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/li
b/python3.5', '/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/python3.5/plat-x86_64-linux-gnu', '/home/testuser/.local/share/virtualenvs/venv-3.
5-8feRiT5s/lib/python3.5/lib-dynload', '/home/testuser/.pyenv/versions/3.5.7/lib/python3.5', '/home/testuser/.local/share/virtualenvs/venv-3.5-8feRiT5s/lib/pyt
hon3.5/site-packages']
The issue can be reproduced in a ubuntu:16.04 docker container.
Debian Bug report logs - #852163: python3.5-minimal wont configure demonstrates that this error (for Python 3.5 and Python 3.6) is due to another incompatible installation of Python in /usr/local.
Some further digging with another user in #debian who was experiencing this
problem indicated that it was related to a locally installed
/usr/local/bin/python3.5. The stdlib in /usr/lib/python3.5 is picked up by the
/usr/local/bin/python3.5 but is not compatible with it, resulting in the
stacktrace shown.
Removing /usr/local/bin/python3* and all traces of that installation from
/usr/local/lib (plus other associated tools) solved this problem for the user
I was helping in #debian.
-- Stuart Prescott (link)
The problem is caused by the system installed python, which conflicts with personally installed python.
It could be the case that other python versions are interfering here. Do you have a PYTHONPATH set?
echo $PYTHONPATH
If it is set you could try to unset it. It's usually not needed when using virtual environments.
Try running python with sudo. I think the python which comes with OS needs to run with admin privilege.
While setting up my new system, I am trying to run my notebook file on VS Code but as soon as I open VS Code it give me this error
Failed to detect Jupyter Notebook. Please use 'Select Jupyter Notebook' command
in the output:
Unable to determine version of Jupyter, Traceback (most recent call last):
File "C:\Anaconda3\Scripts\jupyter-notebook-script.py", line 6, in <module>
from notebook.notebookapp import main
File "C:\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 46, in <module>
from zmq.eventloop import ioloop
File "C:\Anaconda3\lib\site-packages\zmq\__init__.py", line 47, in <module>
from zmq import backend
File "C:\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 40, in <module>
reraise(*exc_info)
File "C:\Anaconda3\lib\site-packages\zmq\utils\sixcerpt.py", line 34, in reraise
raise value
File "C:\Anaconda3\lib\site-packages\zmq\backend\__init__.py", line 27, in <module>
_ns = select_backend(first)
File "C:\Anaconda3\lib\site-packages\zmq\backend\select.py", line 27, in select_backend
mod = __import__(name, fromlist=public_api)
File "C:\Anaconda3\lib\site-packages\zmq\backend\cython\__init__.py", line 6, in <module>
from . import (constants, error, message, context,
ImportError: DLL load failed: The specified module could not be found.
I have installed all the plugins which were necessary, ran various commands, I also updated the notebook.
conda install notebook
I am using:
anaconda 3
vs code 1.26.1
windows 10
I cant start new notebooks or use an existing one either.
Please help, and let me know if any more information is required.
Check the required extensions installed in vscode.
install jupyter and ipython packages in your python venv using pip:
pip install jupyter
pip install ipython
If its still not working try to change the python kernal in the top right corner of ipynb notebook.
This is due to running jupyter without first activating the environment for Python 3.7. This was fixed in the 2018.12.0 release of the extension.
When it fails with this response you can uninstall conda and jupyter and install python from VS Code and then update. Don't necessarily install conda and jupyter.
Python and pip work just fine in PowerShell, but it's different if I run it while activating virtualenv. I got these errors:
(<project_name>-env) PS D:\Kerja\HIT\Python Projects\<project_name>\<project_name>-env\Scripts> python
Traceback (most recent call last):
File "D:\Kerja\HIT\Python Projects\<project_name>\<project_name>-env\lib\site.py", line 703, in <module>
main()
File "D:\Kerja\HIT\Python Projects\<project_name>\<project_name>-env\lib\site.py", line 692, in main
aliasmbcs()
File "D:\Kerja\HIT\Python Projects\<project_name>\<project_name>-env\lib\site.py", line 515, in aliasmbcs
import locale, codecs
File "D:\Kerja\HIT\Python Projects\<project_name>\<project_name>-env\lib\locale.py", line 17, in <module>
import functools
ImportError: No module named functools
(<project_name>-env) PS D:\Kerja\HIT\Python Projects\<project_name>\<project_name>-env\Scripts> pip
Fatal error in launcher: Unable to create process using '"'
How can I run python and pip successfully in virtualenv while using PowerShell?
I found the answer! It turns out when I use virtualenv on PowerShell, it prioritizes using python and pip from the virtualenv over the PATH environment variable.
The python and pip I mentioned before are located on /<environment_name/Scripts/> folder, along with activate and deactivate script. Deleting python.exe and pip.exe or just simply rename it will do.
Please note, it may affect pip freeze -l. I am not sure though.