I am trying to install a package from my github in "editable" (-e) mode to be able to easily work on the repository whilst using it.
However it is causing problems because its not available in the python path after I install it.
With a fresh, clean virtualenv "publisher" created and activated, I run the following:
pip install -e git+https://github.com/roberts81/easy-thumbnails.git#egg=easy_thumbnails
Obtaining easy-thumbnails from git+https://github.com/roberts81/easy-thumbnails.git#egg=easy_thumbnails
Cloning https://github.com/roberts81/easy-thumbnails.git to /Users/ben/Envs/publisher/src/easy-thumbnails
Running setup.py egg_info for package easy-thumbnails
no previously-included directories found matching 'docs/_build'
Installing collected packages: easy-thumbnails
Running setup.py develop for easy-thumbnails
no previously-included directories found matching 'docs/_build'
Creating /Users/ben/Envs/publisher/lib/python2.7/site-packages/easy-thumbnails.egg-link (link to .)
Adding easy-thumbnails 1.2 to easy-install.pth file
Installed /Users/ben/Envs/publisher/src/easy-thumbnails
Successfully installed easy-thumbnails
Cleaning up...
Then if I run python (still in my virtualenv) and try to import anything from that package, It fails.
Python 2.7.2 (default, Jun 20 2012, 16:23:33)
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import easy_thumbnails
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named easy_thumbnails
>>>
If I install it without the -e option, everything works dandy. I get the same effect (i.e. they aren't on the python path after installing them) with other repo's, e.g. pip install -e git+http://github.com/django/django.git@stable/1.5.x#egg=django . So what gives?
One thing I'm noticing is that it doesn't seem to be actually updating the easy-install.pth file even though it says it is... something odd going on here.
But if i run it (the pip install... command) with sudo, it works! Also I can install the package globally (outside the virtualenv, with sudo of course) and that works.
Versions:
pip==1.2.1 virtualenv==1.8.4 virtualenvwrapper==3.6 python==2.7.2 Mac OSX 10.8.2
This might seem silly now since the question has been answered, and this addresses a different issue -- but this was the solution for me when I got this error. (I'm hoping this will help others)
Make sure that you have a __init__.py file in place. The structure should resemble this:
/myprojectname
/myprojectname
__init__.py
mymodule.py
setup.py
Then run "pip install -e ." from within the top level myprojectname folder, everything works. I forgot the __init__.py in my case, and forgot that this is a possible cause for that message.
Working for me with pip 1.2.1 and virtualenv 1.8.4:
$ virtualenv -p python2.7 venv
Running virtualenv with interpreter /usr/local/bin/python2.7
New python executable in venv/bin/python
Installing setuptools............done.
Installing pip...............done.
$ source venv/bin/activate
$ pip install -e git+https://github.com/roberts81/easy-thumbnails.git#egg=easy_thumbnails
Obtaining easy-thumbnails from git+https://github.com/roberts81/easy-thumbnails.git#egg=easy_thumbnails
Cloning https://github.com/roberts81/easy-thumbnails.git to ./venv/src/easy-thumbnails
Running setup.py egg_info for package easy-thumbnails
no previously-included directories found matching 'docs/_build'
Installing collected packages: easy-thumbnails
Running setup.py develop for easy-thumbnails
no previously-included directories found matching 'docs/_build'
Creating /Users/jterrace/test/venv/lib/python2.7/site-packages/easy-thumbnails.egg-link (link to .)
Adding easy-thumbnails 1.2 to easy-install.pth file
Installed /Users/jterrace/test/venv/src/easy-thumbnails
Successfully installed easy-thumbnails
Cleaning up...
$ python
Python 2.7.3 (default, Nov 12 2012, 09:50:25)
[GCC 4.2.1 Compatible Apple Clang 4.1 ((tags/Apple/clang-421.11.66))] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import easy_thumbnails
>>> easy_thumbnails.VERSION
'1.2'
I had a similar problem and solved it by removing my virtualenv, recreating it, activating it, and then (before doing anything else) updating pip and setuptools in the environment. Start by opening a new terminal window (to make sure the virtual env is not activated) and navigate to the directory above where your virtualenv lives. Then do:
rm -rf env
virtualenv env
. env/bin/activate
pip install -U pip setuptools
After this I was able to install the package from GitHub (using pip) and was able to import it in python.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With