I'm installing this package into a virtualenv using virtualenvwrapper and pip with this command:

pip install -e git+git://github.com/mr-stateradio/django-exchange.git#egg=django_exchange-master

Interestingly the package is then placed into a src folder, and not into the site-packages folder which I would have expected. The package is placed into this folder:

<path-to-my-virtual-env>/testenv/src/django-exchange-master/exchange

Instead of this:

<path-to-my-virtual-env>/testenv/lib/python2.7/site-packages

I assume something is wrong with the pip install command I'm using or with the setup.py of the package.

  • 2
    LoL. Stackoverflow is really an amazing place. The details in your question help me solved the same problem that troubled me for hours. – Leonardo.Z Dec 12 '13 at 15:51
up vote 10 down vote accepted

The -e option tells pip to install packages in “editable” mode. If you remove the -e option, pip will install the package into <venv path>/lib/Python_version/site-packages. Don't forget to remove the packages inside <venv path>/src, because python looks for the packages inside <venv path>/src first.

pip supports installing from Git, Mercurial, Subversion and Bazaar, and detects the type of VCS using url prefixes: “git+”, “hg+”, “bzr+”, “svn+”.

e.g

$ pip install -e git+https://git.repo/some_pkg.git#egg=SomePackage          # from git
$ pip install -e hg+https://hg.repo/some_pkg.git#egg=SomePackage            # from mercurial
$ pip install -e svn+svn://svn.repo/some_pkg/trunk/#egg=SomePackage         # from svn
$ pip install -e git+https://git.repo/some_pkg.git@feature#egg=SomePackage  # from 'feature' branch

VCS projects can be installed in editable mode (using the –editable option) or not.

  • For editable installs, the clone location by default is <venv path>/src/SomeProject in virtual environments, and <cwd>/src/SomeProject for global installs. The –src option can be used to modify this location.
  • For non-editable installs, the project is built locally in a temp dir and then installed normally. `
  • Should be --src in pip I think? pip install -r ./requirements.txt --no-cache --src ~/.virtualenvs/PROJECTNAME/src – ncrmro Jun 12 '17 at 16:19

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.