I'm working on a project and recently had to update setup.py to add an extras_require field.
Prev version of project's setup.py was 1.1.3-incomplete. I bumped it up to 1.1.4-incomplete.
When I try to update the package with pip install -e inside my virtualenv, I get weird behavior. It's like pip is somehow caching an old copy of my setup.py file, but only in edit mode.
Here's the relevant bits of my setup.py file:
setup(
name='phpIPAM-Scraper',
version='1.1.4-incomplete',
...
install_requires=[
'configparser ; python_version < "3.2"',
'requests',
'beautifulsoup4',
'tabulate',
'click',
'click-shell'],
extras_require={
'test': [
'pytest',
'pytest-docker',
'pytest-docker-pexpect',
]
},
...
)
And old setup.py was the same, except it didn't have extras_require content.
When I run pip install -e .[test] from my project dir, I get this strange output:
$ pip install -e .[test]
Obtaining file:[project-dir]
phpipam-scraper 1.1.3-incomplete does not provide the extra 'test'
Requirement already satisfied: requests ...
Requirement already satisfied: beautifulsoup4 ...
Requirement already satisfied: tabulate ...
Requirement already satisfied: click ...
Requirement already satisfied: click-shell ...
Requirement already satisfied: certifi>=2017.4.17 ...
Requirement already satisfied: chardet<3.1.0,>=3.0.2 ...
Requirement already satisfied: urllib3<1.22,>=1.21.1 ...
Requirement already satisfied: idna<2.6,>=2.5 ...
Installing collected packages: phpIPAM-Scraper
Found existing installation: phpipam-scraper 1.1.3-incomplete
Not uninstalling phpipam-scraper at [project-dir], outside environment [virtualenv]
Running setup.py develop for phpIPAM-Scraper
Successfully installed phpIPAM-Scraper
BUT, when i run the same command WITHOUT the -e flag, it installs just fine:
$ pip install .[test]
Processing [project-dir]
Requirement already satisfied: requests ...
Requirement already satisfied: beautifulsoup4 ...
Requirement already satisfied: tabulate ...
Requirement already satisfied: click ...
Requirement already satisfied: click-shell ...
Requirement already satisfied: pytest ...
Requirement already satisfied: pytest-docker ...
Requirement already satisfied: pytest-docker-pexpect ...
Requirement already satisfied: chardet<3.1.0,>=3.0.2 ...
Requirement already satisfied: idna<2.6,>=2.5 ...
Requirement already satisfied: certifi>=2017.4.17 ...
Requirement already satisfied: urllib3<1.22,>=1.21.1 ...
Requirement already satisfied: setuptools ...
Requirement already satisfied: py>=1.4.33 ...
Requirement already satisfied: attrs<17,>=16 ...
Requirement already satisfied: pexpect ...
Requirement already satisfied: six ...
Requirement already satisfied: ptyprocess>=0.5 ...
Building wheels for collected packages: phpIPAM-Scraper
Running setup.py bdist_wheel for phpIPAM-Scraper ... done
Stored in directory: [local .cache]
Successfully built phpIPAM-Scraper
Installing collected packages: phpIPAM-Scraper
Found existing installation: phpipam-scraper 1.1.3-incomplete
Not uninstalling phpipam-scraper at [project-dir], outside environment [virtualenv-dir]
Successfully installed phpIPAM-Scraper-1.1.4-incomplete
This doesn't make any sense. It's like pip's edit mode is using a cached file somewhere, but i can't figure out where or how, and my googlefu has failed to find any useful information.
Have any of you fine folks ever encountered this before?
EDIT: I've deleted and recreated the virtualenv, same result. I've also set the version to 1.1.4, no change in behaviour
Related
I have been trying to upgrade a package based off of the most recent changes on git but the changes aren't taking effect. I ran several variations of this command, such as also using python -m pip and the actual path to the pip version in anaconda, as well as adding --upgrade: pip install git+git://github.com/lmcinnes/umap#master
Here is the output each time:
Collecting git+git://github.com/lmcinnes/umap#master
Cloning git://github.com/lmcinnes/umap (to revision master) to /tmp/pip-req-build-bck1u0of
Running command git clone -q git://github.com/lmcinnes/umap /tmp/pip-req-build-bck1u0of
Requirement already satisfied: numpy>=1.17 in /home/himani/anaconda3/lib/python3.7/site-packages (from umap-learn==0.5.1) (1.19.2)
Requirement already satisfied: scikit-learn>=0.22 in /home/himani/anaconda3/lib/python3.7/site-packages (from umap-learn==0.5.1) (0.23.2)
Requirement already satisfied: scipy>=1.0 in /home/himani/anaconda3/lib/python3.7/site-packages (from umap-learn==0.5.1) (1.6.0)
Requirement already satisfied: numba>=0.49 in /home/himani/anaconda3/lib/python3.7/site-packages (from umap-learn==0.5.1) (0.51.2)
Requirement already satisfied: pynndescent>=0.5 in /home/himani/anaconda3/lib/python3.7/site-packages (from umap-learn==0.5.1) (0.5.2)
Requirement already satisfied: llvmlite<0.35,>=0.34.0.dev0 in /home/himani/anaconda3/lib/python3.7/site-packages (from numba>=0.49->umap-learn==0.5.1) (0.34.0)
Requirement already satisfied: setuptools in /home/himani/anaconda3/lib/python3.7/site-packages (from numba>=0.49->umap-learn==0.5.1) (52.0.0.post20210125)
Requirement already satisfied: joblib>=0.11 in /home/himani/anaconda3/lib/python3.7/site-packages (from pynndescent>=0.5->umap-learn==0.5.1) (1.0.0)
Requirement already satisfied: threadpoolctl>=2.0.0 in /home/himani/anaconda3/lib/python3.7/site-packages (from scikit-learn>=0.22->umap-learn==0.5.1) (2.1.0)
And looking in the actual directory of where umap is in site-packages, I can see that none of the files are being changed to reflect the updates, so it seems that nothing is happening. I am tempted to just manually change the files myself but I know that wouldn't be smart for the long run.
try using the --update and --force-reinstall options of pip, or:
pip install --update --force-reinstall git+git://github.com/lcminnes/umap#master
I'm a bit new to using pip to install modules on Python. I believe I have pip installed, however when I try to use the module I've tried to install using pip it says there is no such module. I'll post terminal response to see what happened. I'd really appreciate if somebody can let me know if I'm making a mistake installing modules, thanks for your time.
faizrahman#138-38-186-80 ~ % sudo pip install matplotlib
Password:
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
WARNING: The directory '/Users/faizrahman/Library/Caches/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: matplotlib in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (1.3.1)
Requirement already satisfied: numpy>=1.5 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (1.8.0rc1)
Requirement already satisfied: python-dateutil in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (1.5)
Requirement already satisfied: tornado in /Library/Python/2.7/site-packages (from matplotlib) (5.1.1)
Requirement already satisfied: pyparsing>=1.5.6 in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from matplotlib) (2.0.1)
Requirement already satisfied: nose in /Library/Python/2.7/site-packages (from matplotlib) (1.3.7)
Requirement already satisfied: singledispatch in /Library/Python/2.7/site-packages (from tornado->matplotlib) (3.4.0.3)
Requirement already satisfied: futures in /Library/Python/2.7/site-packages (from tornado->matplotlib) (3.3.0)
Requirement already satisfied: backports-abc>=0.4 in /Library/Python/2.7/site-packages (from tornado->matplotlib) (0.5)
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from singledispatch->tornado->matplotlib) (1.12.0)
faizrahman#138-38-186-80 ~ %
You will need to call pip from python3:
sudo python3 -m pip install matplotlib
This question already has answers here:
Provide a path to gdal-config using a GDAL_CONFIG environment variable error while attempting to install Fiona
(2 answers)
Closed 2 years ago.
C:\Users\white>pip install C:\Users\white\Downloads\geopandas-0.8.0-py2.py3-none-any.whl
Processing c:\users\white\downloads\geopandas-0.8.0-py2.py3-none-any.whl
Requirement already satisfied: shapely in c:\users\white\desktop\python\lib\site-packages (from geopandas==0.8.0) (1.7.0)
Collecting pyproj>=2.2.0
Downloading pyproj-2.6.1.post1-cp36-cp36m-win_amd64.whl (17.3 MB)
|████████████████████████████████| 17.3 MB 3.3 MB/s
Requirement already satisfied: pandas>=0.23.0 in c:\users\white\desktop\python\lib\site-packages (from geopandas==0.8.0) (0.24.1)
Collecting fiona
Using cached Fiona-1.8.13.post1.tar.gz (1.2 MB)
ERROR: Command errored out with exit status 1:
command: 'c:\users\white\desktop\python\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\white\\AppData\\Local\\Temp\\pip-install-wt55_vfn\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\white\\AppData\\Local\\Temp\\pip-install-wt55_vfn\\fiona\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\white\AppData\Local\Temp\pip-install-wt55_vfn\fiona\pip-egg-info'
cwd: C:\Users\white\AppData\Local\Temp\pip-install-wt55_vfn\fiona\
Complete output (1 lines):
A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
WARNING: You are using pip version 20.0.2; however, version 20.1.1 is available.
You should consider upgrading via the 'c:\users\white\desktop\python\python.exe -m pip install --upgrade pip' command.
That's the error I get when trying to install geopandas, it fails on installing Fiona. I tried to install fiona via a whl from the windows whl repository but it told me
C:\Users\white>pip install C:\Users\white\Downloads\Fiona-1.8.4-cp34-cp34m-win_amd64.whl
ERROR: Fiona-1.8.4-cp34-cp34m-win_amd64.whl is not a supported wheel on this platform.
WARNING: You are using pip version 20.0.2; however, version 20.1.1 is available.
You should consider upgrading via the 'c:\users\white\desktop\python\python.exe -m pip install --upgrade pip' command.
Welcome. So there a couple of things you could do. I am running python 3.7, win x64.
Get the GDAL binary distribution from here
I used GDAL-3.1.1-cp37-cp37m-win_amd64.whl.
Then I downloaded Fiona whl from here, specifically Fiona-1.8.13-cp37-cp37m-win_amd64.whl.
On to the installation
First install GDAL binary distribution from 2 above.
set GDAL_VERSION=3.1.1 in the same command prompt session.
Modify you PATH to include GDAL include files, specifically gdal.h
For me the location was %PYTHON_HOME%\Lib\site-packages\osgeo\include\gdal
Like set PATH=%PYTHON_HOME%\Lib\site-packages\osgeo\include\gdal:%PATH%
Then install Fiona, from point 3 above Fiona-1.8.13-cp37-cp37m-win_amd64.whl.
Lastly, install your geopandas library.
Below is my output.
S:\so>pip install GDAL-3.1.1-cp37-cp37m-win_amd64.whl
Processing s:\so\gdal-3.1.1-cp37-cp37m-win_amd64.whl
Installing collected packages: GDAL
Successfully installed GDAL-3.1.1
S:\so>set GDAL_VERSION=3.1.1
set PATH=%PYTHON_HOME%\Lib\site-packages\osgeo\include\gdal\:%PATH%
S:\so>pip install Fiona-1.8.13-cp37-cp37m-win_amd64.whl
Processing s:\so\fiona-1.8.13-cp37-cp37m-win_amd64.whl
Requirement already satisfied: click>=4.0 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
Fiona==1.8.13) (7.1.2)
Requirement already satisfied: attrs>=17 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
Fiona==1.8.13) (19.3.0)
Requirement already satisfied: six>=1.7 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
Fiona==1.8.13) (1.14.0)
Requirement already satisfied: click-plugins>=1.0 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
Fiona==1.8.13) (1.1.1)
Requirement already satisfied: cligj>=0.5 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
Fiona==1.8.13) (0.5.0)
Requirement already satisfied: gdal~=3.1.1 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
Fiona==1.8.13) (3.1.1)
Requirement already satisfied: munch in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
Fiona==1.8.13) (2.5.0)
Installing collected packages: Fiona
Successfully installed Fiona-1.8.13
S:\so>pip install geopandas-0.8.0-py2.py3-none-any.whl
Processing s:\so\geopandas-0.8.0-py2.py3-none-any.whl
Requirement already satisfied: pyproj>=2.2.0 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
geopandas==0.8.0) (2.6.1.post1)
Requirement already satisfied: fiona in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
geopandas==0.8.0) (1.8.13)
Requirement already satisfied: pandas>=0.23.0 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
geopandas==0.8.0) (1.0.5)
Requirement already satisfied: shapely in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
geopandas==0.8.0) (1.7.0)
Requirement already satisfied: six>=1.7 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from fiona-
>geopandas==0.8.0) (1.14.0)
Requirement already satisfied: munch in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from fiona-
>geopandas==0.8.0) (2.5.0)
Requirement already satisfied: attrs>=17 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from fiona-
>geopandas==0.8.0) (19.3.0)
Requirement already satisfied: cligj>=0.5 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from fiona-
>geopandas==0.8.0) (0.5.0)
Requirement already satisfied: click>=4.0 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from fiona-
>geopandas==0.8.0) (7.1.2)
Requirement already satisfied: click-plugins>=1.0 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from fiona-
>geopandas==0.8.0) (1.1.1)
Requirement already satisfied: gdal~=3.1.1 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from fiona-
>geopandas==0.8.0) (3.1.1)
Requirement already satisfied: numpy>=1.13.3 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
pandas>=0.23.0->geopandas==0.8.0) (1.19.0)
Requirement already satisfied: python-dateutil>=2.6.1 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
pandas>=0.23.0->geopandas==0.8.0) (2.8.1)
Requirement already satisfied: pytz>=2017.2 in
c:\users\so\appdata\local\programs\python\python37\lib\site-packages (from
pandas>=0.23.0->geopandas==0.8.0) (2020.1)
Installing collected packages: geopandas
Successfully installed geopandas-0.8.0
S:\so>python
Python 3.7.7 (tags/v3.7.7:d7c567b08f)
Type "help", "copyright", "credits" or "license" for more information.
>>> import geopandas
>>> geopandas.__version__
'0.8.0'
>>> geopandas.__file__
'C:\\Users\\so\\AppData\\Local\\Programs\\Python\\Python37\\lib\\site-
packages\\geopandas\\__init__.py'
>>>
HTH
More help here Under Installation -> Windows.
I'm still trying to master the science of installing packages via pip. When I run pip to install geocoder, I get the following:
(base) C:\Users\MBSanders>python -m pip install geocoder
Requirement already satisfied: geocoder in c:\programdata\anaconda3\lib\site-packages (1.38.1)
Requirement already satisfied: requests in c:\programdata\anaconda3\lib\site-packages (from geocoder) (2.21.0)
Requirement already satisfied: future in c:\programdata\anaconda3\lib\site-packages (from geocoder) (0.17.1)
Requirement already satisfied: click in c:\programdata\anaconda3\lib\site-packages (from geocoder) (7.0)
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from geocoder) (1.12.0)
Requirement already satisfied: ratelim in c:\programdata\anaconda3\lib\site-packages (from geocoder) (0.1.6)
Requirement already satisfied: certifi>=2017.4.17 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (2019.3.9)
Requirement already satisfied: idna<2.9,>=2.5 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (2.8)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\programdata\anaconda3\lib\site-packages (from requests->geocoder) (3.0.4)
Requirement already satisfied: decorator in c:\programdata\anaconda3\lib\site-packages (from ratelim->geocoder) (4.4.0)
When I run
os.getcwd()
in spyder/python, I get
'C:\\Users\\MBSanders'
My question is, why do I get
ModuleNotFoundError: No module named 'geocoder'
When I run
import geocoder
I'm somewhat new to python. Please let me know if additional info is needed to trouble shoot. I'm within a federal agency so I do not have admin rights.
When I run sys.path in the console, I get
sys.path
Out[12]:
['F:\\Users\\MBSanders',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\python37.zip',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\DLLs',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3',
'',
'C:\\Users\\MBSanders\\AppData\\Roaming\\Python\\Python37\\site-packages',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\win32\\lib',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\Pythonwin',
'C:\\Users\\MBSanders\\AppData\\Local\\Continuum\\anaconda3\\lib\\site-packages\\IPython\\extensions',
'F:\\Users\\MBSanders\\.ipython']
Assuming you're running python on the terminal, and python is the command you're using to run it, try doing python -m pip install geocoder. That'll install it for the python build you want to use. Or if you know the full path to the python build you're using, you can do something similar like /path/to/python -m pip install geocoder.
if you are using python 3.7 or 3.8 you may need to pip3.7 or pip3.8 install if you OS is recognizing a 2.x version as default
I'm trying to install boto3 on my mac (high sierra 10.13.3) and tried to follow : https://github.com/boto/boto3. I had already installed python 3 using homebrew before, but when I tried to see pip --version, I get error.
So, I did
1) modify .bash_profile to add
alias pip=pip3
2) verify
$ pip --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
3)
$ pip install boto3
Collecting boto3
Downloading boto3-1.5.36-py2.py3-none-any.whl (128kB)
100% |████████████████████████████████| 133kB 474kB/s
Collecting botocore<1.9.0,>=1.8.50 (from boto3)
Downloading botocore-1.8.50-py2.py3-none-any.whl (4.1MB)
100% |████████████████████████████████| 4.1MB 376kB/s
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: docutils>=0.10 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in ./Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)
Installing collected packages: botocore, boto3
Found existing installation: botocore 1.8.20
Uninstalling botocore-1.8.20:
Successfully uninstalled botocore-1.8.20
Successfully installed boto3-1.5.36 botocore-1.8.50
4) just to make sure this was fine, I ran
$ pip3 install boto3
Requirement already satisfied: boto3 in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: botocore<1.9.0,>=1.8.50 in /usr/local/lib/python3.6/site-packages (from boto3)
Requirement already satisfied: docutils>=0.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)
5) but, now when I ran import boto3 in Idle, I get error
import boto3
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import boto3
ModuleNotFoundError: No module named 'boto3'
I even tried to change path in .bash_profile, but it did not work.
Thoughts?
It worked for me to just copy all of packages with "bolo" in the name from the Python 3.7 folder to the Python 2.7 folder:
/usr/local/lib/python3.7/site-packages $ sudo cp -R boto* /Library/Python/2.7/site-packages/.