I can't find the correct way to install a local directory as a python package using pip.
(venv) C:\(...)>pip install . --no-index
Ignoring indexes: http://pypi.python.org/simple/
Unpacking c:\users\fsantos\desktop\biskates.com\biskates\forks\django-pipeline
Running setup.py egg_info for package from file:///(...)%5Cforks%5Cdjango-pipeline
Installing collected packages: django-pipeline
Running setup.py install for django-pipeline
Successfully installed django-pipeline
Cleaning up...
(venv) C:\(...)>cd ..
(venv) C:\(...)>python
Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pipeline
>>> pipeline.__file__
'C:\\(...)site-packages\\pipeline\\__init__.py'
>>>
As you can see pip just copied over the package to site-packages. How can I avoid this, and use the package directly from its source folder?
I'm trying to integrate django-pipeline into my Django project, but I want to add support for Django 1.4 first, so I forked and cloned my fork.
I can also just use:
cd your-local-repo
pip install -e .
or
python setup.py install develop
If you're working in a venv, you can do this:
env/bin/pip install git+file:///path/to/your/git/repo
Or with a branch:
env/bin/pip install git+file:///path/to/your/git/repo#mybranch
You can use pip or pipenv with the following command to install from a local git repo:
pip install git+file:///path/to/your/package#egg=package-name
Note that there are 3 slashes after file: here.
To install from a remote repo use:
pip install git+ssh://git#github.com:Username/Project.git
You can also specify a desired branch like so:
pip install git+ssh://git#github.com:Username/Project.git#master
I just rounded up the previous answers and comments from Quilt and nanounanue and this question. Also posted it here.
Related
In sklearn\base.py, I have the statement from scipy import sparse.
I am getting this error "no module named scipy".
I tried to install using pip install scipy, but I get so many errors:
libraries mkl_rt not found
openblas not found
lapack not found
no lapacl/blas resources found
etc.
What should I do on Windows?
I found this solution after days.
Firstly which python version you want to install?
If you want for Python 2.7 version:
STEP 1:
scipy‑0.19.0‑cp27‑cp27m‑win32.whl
scipy‑0.19.0‑cp27‑cp27m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win32.whl
numpy‑1.11.3+mkl‑cp27‑cp27m‑win_amd64.whl
If you want for Python 3.4 version:
scipy‑0.19.0‑cp34‑cp34m‑win32.whl
scipy‑0.19.0‑cp34‑cp34m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win32.whl
numpy‑1.11.3+mkl‑cp34‑cp34m‑win_amd64.whl
If you want for Python 3.5 version:
scipy‑0.19.0‑cp35‑cp35m‑win32.whl
scipy‑0.19.0‑cp35‑cp35m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win32.whl
numpy‑1.11.3+mkl‑cp35‑cp35m‑win_amd64.whl
If you want for Python 3.6 version:
scipy‑0.19.0‑cp36‑cp36m‑win32.whl
scipy‑0.19.0‑cp36‑cp36m‑win_amd64.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win32.whl
numpy‑1.11.3+mkl‑cp36‑cp36m‑win_amd64.whl
Link: click
Once the download finished, go to your directory.
For example my directory:
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip install [where/is/your/downloaded/scipy_whl.]
After that installation
STEP 2:
Numpy+MKL
From same web site based on python version again:
After that use same thing again in Script folder
cd C:\Users\asus\AppData\Local\Programs\Python\Python35\Scripts>
pip3 install [where/is/your/downloaded/numpy_whl.]
And test it in python folder.
Python35>python
Python 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:18:55) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Download the scipy wheel file from the following link
https://pypi.python.org/pypi/scipy
Then do pip install with the Downloaded file
pip install <wheel-file>
if required , provide sudo permission
I face same problem when install Scipy under ubuntu.
I had to use command:
$ sudo apt-get install libatlas-base-dev gfortran
$ sudo pip install scipy
on CentOS
$ yum install lapack-devel
$ sudo pip install scipy
numpy should be installed before installing scipy. I face this issue when I was running only with numpy. First install numpy and then install scipy. It worked for me.
pip install numpy
pip install scipy
It will display a message like this.
Requirement already satisfied: numpy>=1.8.2 in
(from scipy)
Hope this would be helpful. :)
I have never successfully pip'd a scipy install, instead I have found it easier to install all the base dependencies. Check here for your OS
I've never tried this on windows, but the linux installs have always worked for me.
Brew is not able to find dependency inspite of it being installed.
dependency 'urllib2_kerberos' is already installed yet homebrew throws the message
Homebrew does not provide special Python dependencies; install with: pip install urllib2_kerberos
Here are the setup steps:
$ sudo pip2.7 install urllib2_kerberos
Requirement already satisfied (use --upgrade to upgrade):
urllib2_kerberos in
/usr/local/lib/python2.7/site-packages/urllib2_kerberos-0.1.6-py2.7.egg
$ sudo pip2.7 install urllib2_kerberos --upgrade
Requirement already up-to-date: urllib2_kerberos in
/usr/local/lib/python2.7/site-packages/urllib2_kerberos-0.1.6-py2.7.egg
$ brew install post-review
post-review: Unsatisfied dependency: urllib2_kerberos Homebrew does
not provide special Python dependencies; install with: pip install
urllib2_kerberos Error: An unsatisfied requirement failed this build.
Also tried
$ /usr/local/bin/python2.7
It successfully imports
Python 2.7.12 (default, Jun 29 2016, 14:04:44) [GCC 4.2.1 Compatible
Apple LLVM 7.0.2 (clang-700.1.81)] on darwin Type "help", "copyright",
"credits" or "license" for more information.
>>> import urllib2_kerberos
(Note: post-review is not on http://braumeister.org/ .
I tapped into another formula repo)
Just encountered this problem myself. The solution is making sure the dependencies are available in your path.
In my case, I'm running with Anaconda Python and had anaconda2/bin in my path but not anaconda2/lib.
I added the following to my zshrc:
export PATH="/Users/$ME/anaconda2/lib/python2.7/site-packages:/Users/$ME/anaconda2/lib/python2.7:/Users/$ME/anaconda2/lib:$PATH"
Then source ~/.zshrc (or your respective shell resource file) and you're good.
I am currently using a python package that depends on requests 2.7.0 or greater, but the requests in my system, Ubuntu 14.04, is version 2.2.1. I tried to upgrade via pip:
pip install requests==2.7.0
but it gives me an error, saying:
Not uninstalling requests at /usr/lib/python2.7/dist-packages, owned by OS
I tried to upgrade it by using apt-get install --only-upgrade python-requests, but it says that it is already on the latest version (and it's not).
Then I tried to install in a virtual env, but it gives the same message as the pip message above.
Finally, I thought about two options:
1-) Uninstalling via apt-get and then installing via pip - I think it's too risky, since it will uninstall a lot of other packages.
2-) Cloning from github and manually installing via setup.py, but I also fear that it may mess with other packages depending on it
What is the best way to do it? Is there something simple I am missing?
This works for me on Ubuntu 14.04:
~ › sudo apt-get install -u python-requests
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-requests is already the newest version.
python-requests set to manually installed.
0 to upgrade, 0 to newly install, 0 to remove and 15 not to upgrade.
~ › python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.0.1'
>>>
~ › mkvirtualenv test
New python executable in test/bin/python
Installing setuptools, pip, wheel...done.
~ (test) › pip install requests
Collecting requests
Using cached requests-2.9.1-py2.py3-none-any.whl
Installing collected packages: requests
Successfully installed requests-2.9.1
~ (test) › python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> requests.__version__
'2.9.1'
>>>
I wonder why your OS/Ubuntu version of requests is 2.2.1, whereas mine is 2.0.1. Have you installed a newer version of requests manually, via some other mechanism than the official python-requests .deb package? As suggested by #wilbur in the comments above, is it possible you have run sudo pip install requests at some point in the past? If so, it might be worth running sudo pip uninstall requests to see if you can get rid of it...
I needed requests >2.10.0 for socks proxy built-in support.
Force uninstall
dpkg --remove --force-depends python-requests breaks apt (even if requests is pip installed).
apt-get install python-requests rolls it back to 2.2.1, the maximum version in trusty repo.
However, yakkety ubuntu repo contains 2.10.0 python-requests, as needed, so i did the following:
apt-add-repository "deb http://us.archive.ubuntu.com/ubuntu/ yakkety main"
apt-get update
apt-get install python-requests # it installs 2.10.0
apt-add-repository -r "deb http://us.archive.ubuntu.com/ubuntu/ yakkety main"
apt-get update
Note! It is essential to do the second apt-get update to remove yakkety index not to execute apt-get upgrade occasionally and break your system.
So now I have the required version.
$ sudo pip2 show requests
---
Name: requests
Version: 2.10.0
Location: /usr/lib/python2.7/dist-packages
Requires:
I have installed Python 3.3.3 with a command:
sudo apt-get install python3
I am calling it as Python3, because I have Python 2.7 installed as well.
I have also installed distribute (setuptools) with a command:
sudo apt-get install python3-setuptools
To be sure, setuptools are installed for python3, I have searched with pip3 and I received an output:
$ pip3 search setuptools
setuptools - Easily download, build, install, upgrade, and
uninstall Python packages
INSTALLED: 2.0 (latest)
Now I want to install NLTK's version for Python 3, so nltk3.0a3. I have downloaded it from the official site, and in the folder I ran a standard python installation and received an output:
$ python3 setup.py install
Traceback (most recent call last):
File "setup.py", line 33, in <module>
from setuptools import setup, find_packages
ImportError: No module named 'setuptools'
And in fact, when I go to python3 command line, for that input, I see the output:
>>> help('modules setup')
ez_setup - Bootstrap setuptools installation
setup
unittest.test.test_setups
So there is really no module called setuptools...
Does anyone know what am I doing wrong? Or is there any other way of installing NLTK for python 3? (in apt, there is only NLTK for python 2).
Thanks a lot guys for any effort!
You can use muon or your favorite package manager to install python3-setuptools and an experimental version of nltk supporting Python 3 is available at http://nltk.org/nltk3-alpha/
I suspect you will also need pyyaml and numpy installed for your python 3.
I gave this a try:
muon
check that I have installed python3-setuptools and python3-numpy
sudo pip3 install pyyaml
Having downloaded and unpacked the code from the above link
cd ~/ToolBuild/nltk-3.0a3/nltk-3.0a3
sudo python3 setup.py install
python3
Python 3.3.2+ (default, Oct 9 2013, 14:50:09)
[GCC 4.8.1] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import nltk
>>> dir(nltk)
['AbstractLazySequence', 'AffixTagger', 'AlignedSent', 'Alignment', 'AnnotationTask', 'Assignment', 'BigramAssocMeasures', 'BigramCollocationFinder', 'BigramTagger', 'BinaryMaxentFeatureEncoding', 'BlanklineTokenizer', 'BottomUpChartParser', 'BottomUpLeftCornerChartParser', 'BottomUpProbabilisticChartParser', 'Boxer', 'BrillTagger', 'BrillTaggerTrainer', 'CfgReadingCommand', 'ChartParser', 'ChunkParserI',..........
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
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'
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.
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.
Although it addresses a different issue, following this Mac OSX 10.8-specific thread to its conclusion seemed to solve the problem for me.
Specifically, I installed distribute not using pip:
$ curl -O http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
Then I added export VIRTUALENV_DISTRIBUTE=1 to my ~/.bashrc file and restarted my terminals.
I uninstalled and reinstalled virtualenv and virtualenvwrapper just to be safe.
Then I destroyed my old virtual env's and recreated them. For whatever reason, fixing up virtualenv to use and install distribute fixes the problem. Wacky.