After an update of OS X Yosemite 10.10.5 my Python install has blown up. I am not using brew, macports, conda or EPD, here, but a native Python build. While it was perfectly functional before, now it seems to have lost track of the installed packages. I try to start an ipython session and it returns
$ ipython
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython", line 7, in <module>
from IPython import start_ipython
ImportError: No module named IPython
Then I resort to checking whether I can re-install ipython but my pip also went missing:
$ sudo pip install ipython
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named pip
So may it be that pip disappeared?
$ sudo easy_install install pip
Traceback (most recent call last):
File "/System/Library/Frameworks/Python.framework/Versions/2.7/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
ImportError: No module named pkg_resources
I have tried solutions to this last problem reported before but they do not seem to work.
So it seems that Python has lost track of itself. Anyone, clues of what may have gone wrong and how can I fix this? Thanks!
It is not quite clear what you mean by saying that you installed "a native Python build". But in any case, it seems you wrote files of your installation into the system directory" /System/..., which is not a good thing to do, since these are controlled by OSX and e.g. may be overwritten by a system update.
Apparently, that is then what happened. You updated OSX, it clobbered your changes to /System/... and thereby messed up your Python installation.
Note that AFAIK, with OSX 10.11 it will no longer even be possible to write into system directories, so you will need a different setup anyway.
A suggestion to avoid/fix this is simple: Use one of the standard ways to install your Python stack -- my personal recommendation is either macports or anaconda.
Related
I am using a windows computer. When I run the command(which is below) it does not work and says something about dlib. I looked at this stack overflow post but no answers worked:
Stackoverflow post
My install:
>>> pip install face-recognition
My code:
import face_recognition
image = face_recognition.load_image_file("your_file.jpg")
face_landmarks_list = face_recognition.face_landmarks(image)
error:
Traceback (most recent call last):
File "main.py", line 1, in <module>
import face_recognition
ModuleNotFoundError: No module named 'face_recognition'
Face_recognition package is not officially supported on Windows but it might be work,
Here is the two way, You can install face_recognition package,
For Windows 10, You can follow these steps,
https://github.com/ageitgey/face_recognition/issues/175#issue-257710508
They are also providing ready-made virtual environment for this, So you can install it on your Windows system from here by using virualbox.
https://medium.com/#ageitgey/try-deep-learning-in-python-now-with-a-fully-pre-configured-vm-1d97d4c3e9b
I know Windows is not supporting face_recognition package but I guess this will little bit help you.
It seems the package doesn't seem installed. You may be running in a different environment.
I recently tried to create my own pip package. I followed this guide, uploaded to pip. And after I install it python just returns error that module is not found, even if I type pip freeze, the module is installed there.
Also I tried to install it on my Windows pc (prev. machine is Ubuntu) and it doest't work there as well. Any tips?
EDIT:
https://pypi.org/project/PyColours/
The output:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'PyColours'
You named main directory PyColours_pkg so you need to
import PyColours_pkg
Or rename the directory to PyColours, increase version, recreate and reupload the package.
Depending on which installation of Python I am using I have some problems to load a module. When I type
from quantecon import approx_markov
in the terminal using Python 3.4.0, the following error message is returned:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.4/dist-packages/quantecon/__init__.py", line 6,in <module>
from asset_pricing import AssetPrices
ImportError: No module named 'asset_pricing'
In the folder /usr/... as referred to above, I do however find a module called asset_pricing. (I have to admit that I additionally do not understand why the module asset_pricing interferes.)
I installed quantecon with:
pip3 install quantecon
I suspect that the problems are related to the Python version I am using. I also installed
pip install quantecon
and when I call the module approx_markov form the terminal, using Python 2.7.6 (I think this is the standard Python version of the OS I am using) I do not receive any error message. To solve the problem I already followed the instruction in the following discussion but to no avail Python3 has no acces to python2 modules (ubuntu).
The currently released version of quantecon is not Python 3 compatible; it uses relative imports and these are not supported anymore in Python 3.
The version in the source repository has been refactored and updated, and looks like it'll work with Python 3. You'll need to install that version instead:
pip3 install -U git+https://github.com/jstac/quant-econ.git
where -U tells pip3 to upgrade the package.
Note that there have been a lot of changes recently; use at your own risk. You could stick with Python 2 and wait for an official release.
I try to import glib in Python (2.7) and get the following error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/share/pyshared/glib/__init__.py", line 22, in <module>
from glib._glib import *
ImportError: No module named _glib
Seems as if glib is found, while _glib is not found.
Has anybody a hint for solving this problem? I'm running Ubuntu and installed python2.7, python-gobject, python-gda, dbus from Ubuntu's package manager.
I had this issue.
You can try moving the glib and related folders out of the python2.7 install locations e.g. on ubuntu /usr/shared/pyshared in case these have been installed wrongly.
Then remove and reinstalling the related packages with the platform package manager ...
sudo apt-get remove
followed by sudo apt-get install
for ...
python-gobject python-gtk libglib2.0-dev python-cario python-gi
since if they are present in pyshared I found that they were not probably reinstalled
I run ubuntu 10.04, with its native python 2.6.6 and GCC 4.4.5, and an "import glib" in python appears to work.
I installed "python-numpy", "python-matplotlib" and "python-pyfits" with the synaptic package manager and nothing else, in particular nothing installed from a more recent version found on the package's site because previous experience learned me this was usually a very bad idea.
But I have NO /usr/share/pyshared/glib/ folder and do not know how you get it.
Is this folder on your path or PYTHONPATH ?
If yes, try to remove it from the path and retry the "import glib", it is possible that you get some second installation of glib in that place (installed - and maybe needed - by another package).
glib is an interface to the c compiler, so it is used in several places. What is your GCC version ? GTK also makes intensive use of glib. Did you installed "GTK" and "pygtk" from the synaptic or did you did it on the hard way, with all separated little packes to be compiled ? If yes, try to install it from the synaptic.
I mostly think this comes from some installation mix of some python extension somewhere. The radical solution, of course, is to reformat the computer with a fresh O.S., but it's probably something you do not want, so I should try to uninstall all packages python uses, and re-install them from the synaptic.
Hope this helps...
Just installed fabric, trying to use to same fabfile that works on a different server, getting this error here:
Traceback (most recent call last):
File "/var/lib/python-support/python2.6/fabric.py", line 1211, in main
load(fabfile, fail='warn')
File "/var/lib/python-support/python2.6/fabric.py", line 467, in load
execfile(filename)
File "fabfile.py", line 2, in <module>
from fabric.api import *
ImportError: No module named api
Your problem is that you named a file fabric.py somewhere in your python path. (probably in your current working directory)
Rename it to something else and then it will not have any issues.
I accidentally do this all the time and it is annoying.
Looks like you have different versions of Fabric on those servers, they changed the module structure recently.
I just got this message on my Ubuntu 9.10 machine; Ubuntu ships with an old version of fabric (0.1.1). The latest release version is 0.9.0.
sudo easy_install fabric
should get you the latest released version.
I had this problem when I installed fabric using disutils on OS X. So I removed it and reinstalled with pip. works fine.
To remove: Delete the Fabric egg in site-packages directory.
then install using pip
sudo pip install fabric