Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

package is installed via pip in wrong (src) directory instead of site packages

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.

like image 797
Thomas Kremmel Avatar asked May 28 '13 06:05

Thomas Kremmel


1 Answers

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. `
like image 98
Leonardo.Z Avatar answered Oct 14 '22 13:10

Leonardo.Z