Can't install docopt module in a virtual env - linux

I am trying to install docopt module in a virtual env, which is failing, but able to install urllib3 module.
I am creating virtual env as a unprivileged user
$ python3 -m venv yogi-venv
$ source yogi-venv/bin/activate
$ pip3 install urllib3
Collecting urllib3
Using cached https://files.pythonhosted.org/packages/5f/64/43575537846896abac0b15c3e5ac678d787a4021e906703f1766bfb8ea11/urllib3-1.26.6-py2.py3-none-any.whl
Installing collected packages: urllib3
Successfully installed urllib3-1.26.6
You are using pip version 10.0.1, however version 21.2.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
$ pip3 install --upgrade pip
Collecting pip
Downloading https://files.pythonhosted.org/packages/8a/d7/f505e91e2cdea53cfcf51f4ac478a8cd64fb0bc1042629cedde20d9a6a9b/pip-21.2.2-py3-none-any.whl (1.6MB)
100% |████████████████████████████████| 1.6MB 15.2MB/s
Installing collected packages: pip
Found existing installation: pip 10.0.1
Uninstalling pip-10.0.1:
Successfully uninstalled pip-10.0.1
Successfully installed pip-21.2.2
$ pip3 list
Package Version
---------- -------
pip 21.2.2
setuptools 39.0.1
urllib3 1.26.6
$ pip3 install docopt
Collecting docopt
Using cached docopt-0.6.2.tar.gz (25 kB)
ERROR: Command errored out with exit status 1:
command: /home/servicejenkins_build/yogi-venv/bin/python3 -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-r1pocera/docopt_bf20fbd042814635ba33a7f102d490d3/setup.py'"'"'; __file__='"'"'/tmp/pip-install-r1pocera/docopt_bf20fbd042814635ba33a7f102d490d3/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-lk__1tg2
cwd: /tmp/pip-install-r1pocera/docopt_bf20fbd042814635ba33a7f102d490d3/
Complete output (7 lines):
running egg_info
creating /tmp/pip-pip-egg-info-lk__1tg2/docopt.egg-info
writing /tmp/pip-pip-egg-info-lk__1tg2/docopt.egg-info/PKG-INFO
writing dependency_links to /tmp/pip-pip-egg-info-lk__1tg2/docopt.egg-info/dependency_links.txt
writing top-level names to /tmp/pip-pip-egg-info-lk__1tg2/docopt.egg-info/top_level.txt
writing manifest file '/tmp/pip-pip-egg-info-lk__1tg2/docopt.egg-info/SOURCES.txt'
error: [Errno 13] Permission denied: '/usr/local/lib/python3.7/lib2to3/Grammar3.7.0.final.0.pickle'
----------------------------------------
WARNING: Discarding https://files.pythonhosted.org/packages/a2/55/8f8cab2afd404cf578136ef2cc5dfb50baa1761b68c9da1fb1e4eed343c9/docopt-0.6.2.tar.gz#sha256=49b3a825280bd66b3aa83585ef59c4a8c82f2c8a522dbe754a8bc8d08c85c491 (from https://pypi.org/simple/docopt/). Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Using cached docopt-0.6.1.tar.gz (25 kB)
Any ideas where I am wrong?

Related

pygame 2.0.0 installation error on m1 macOS Big Sur

I used python3 -m pip install pygame==2.0.0 via non-rosetta terminal and got these errors:
ERROR: Command errored out with exit status 1:
command: /opt/homebrew/opt/python#3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/1q/4hfh5j_d715b0vm49lql6vl80000gn/T/pip-install-cqq2oily/pygame_3a311b7a5339480eb6bae08f88ff3fe6/setup.py'"'"'; __file__='"'"'/private/var/folders/1q/4hfh5j_d715b0vm49lql6vl80000gn/T/pip-install-cqq2oily/pygame_3a311b7a5339480eb6bae08f88ff3fe6/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 /private/var/folders/1q/4hfh5j_d715b0vm49lql6vl80000gn/T/pip-pip-egg-info-ig7pjjbc
cwd: /private/var/folders/1q/4hfh5j_d715b0vm49lql6vl80000gn/T/pip-install-cqq2oily/pygame_3a311b7a5339480eb6bae08f88ff3fe6/
ERROR: Could not find a version that satisfies the requirement pygame==2.0.0
ERROR: No matching distribution found for pygame==2.0.0
My homebrew, pip3 are all up to date.
Any help would be appreciated!
I already had the same problem: the pip module only detected a pygame version older than 2.0.0.
It always installed pygame 1.9.6.
Maybe you should:
1. Upgrade pip
I don't know how pip works, but I updated it by typing
python3 -m pip install --upgrade pip
Then, when I typed again
python3 -m pip install pygame
pip downloaded the 2.0.1 version of pygame correctly.
2. Check your internet connection
Of course the modules come from Internet.

Unable to install geopandas on python3.9 on macOS Big Sur

I am trying to install geopandas on the machine described above.
This is what I am doing the error I get:
sudo pip3 install geopandas
Collecting geopandas
Downloading geopandas-0.8.1-py2.py3-none-any.whl (962 kB)
|████████████████████████████████| 962 kB 5.0 MB/s
Collecting fiona
Downloading Fiona-1.8.18.tar.gz (1.3 MB)
|████████████████████████████████| 1.3 MB 4.8 MB/s
ERROR: Command errored out with exit status 1:
command: /usr/local/opt/python#3.9/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-fbu0u179/fiona/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-fbu0u179/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 /private/tmp/pip-pip-egg-info-knmlby9t
cwd: /private/tmp/pip-install-fbu0u179/fiona/
Complete output (2 lines):
Failed to get options via gdal-config: [Errno 2] No such file or directory: 'gdal-config'
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.
GDAL is a required library for Geopandas and it needs to be built and compiled on your system and in your path before you pip install geopandas
If you are using homebrew, you can install it with
brew install gdal
and verify the installation by running
gdal-config --version
One note is that Gdal has a lot of dependencies and will take a bit to install. Using homebrew, it worked for me in one shot but it will likely upgrade a number of prerequisites including GCC and perhaps even python itself.
I should note that this worked for me on Catalina. If you are an M1 Mac with Big Sur every tool in this chain may not be upgradeable to native M1 code at this time and you may need some of the workarounds at How to run the Homebrew installer under Rosetta 2 on M1 Macbook

how to install matplotlib with pip

How can I install matplotlib with pip. I have try to use pip install or install from source
I have python 3.9 beta version btw
git clone git#github.com:matplotlib/matplotlib.git
cd matplotlib
python -mpip install .
but I get the following error
$pip install matplotlib
Collecting matplotlib
Using cached matplotlib-3.3.2.tar.gz (37.9 MB)
ERROR: Command errored out with exit status 1:
command: /Users/a/.pyenv/versions/3.9.0b5/bin/python3.9 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/k0/3v16x2k52tdf00j6tpm7wffc0000gp/T/pip-install-vq_esy_g/matplotlib/setup.py'"'"'; __file__='"'"'/private/var/folders/k0/3v16x2k52tdf00j6tpm7wffc0000gp/T/pip-install-vq_esy_g/matplotlib/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 /private/var/folders/k0/3v16x2k52tdf00j6tpm7wffc0000gp/T/pip-pip-egg-info-ny9shc_k
cwd: /private/var/folders/k0/3v16x2k52tdf00j6tpm7wffc0000gp/T/pip-install-vq_esy_g/matplotlib/
Complete output (63 lines):
WARNING: The wheel package is not available.
Edit setup.cfg to change the build options; suppress output with --quiet.
BUILDING MATPLOTLIB
matplotlib: yes [3.3.2]
python: yes [3.9.0b5 (default, Oct 2 2020, 00:38:55) [Clang 11.0.3
(clang-1103.0.32.29)]]
platform: yes [darwin]
sample_data: yes [installing]
tests: no [skipping due to configuration]
macosx: yes [installing]
running egg_info
...
File "/private/var/folders/k0/3v16x2k52tdf00j6tpm7wffc0000gp/T/pip-install-vq_esy_g/matplotlib/setupext.py", line 469, in add_numpy_flags
import numpy as np
File "/private/var/folders/k0/3v16x2k52tdf00j6tpm7wffc0000gp/T/pip-install-vq_esy_g/matplotlib/.eggs/numpy-1.19.2-py3.9-macosx-10.15-x86_64.egg/numpy/__init__.py", line 286, in <module>
raise RuntimeError(msg)
RuntimeError: Polyfit sanity test emitted a warning, most likely due to using a buggy Accelerate backend. If you compiled yourself, see site.cfg.example for information. Otherwise report this to the vendor that provided NumPy.
RankWarning: Polyfit may be poorly conditioned
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
Since your python version is 3.9 you can install matplotlib with pip3
pip3 install matplotlib
You can also try
python3 -m pip3 install -U matplotlib
Edit
You may not have installed the setup tools correctly, try :
pip install --upgrade setuptools
and then pip install matplotlib

Can't install scipy to Raspberry pi 4 (raspbian)

I am trying to install the scipy library with python3 -m pip install --user --no-use-pep517 scipy but I am receiving the following error:
ERROR: Failed building wheel for scipy
Running setup.py clean for scipy
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-spokr6ic/scipy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-spokr6ic/scipy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
cwd: /tmp/pip-install-spokr6ic/scipy
I am using that code to install because pip3 install scipy is giving me this error:
ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly
How can I resolve this issue?
Python == 3.7.3
PS:The complete traceback is 414 lines. I don't know if I should include here.
Try this:
sudo apt update
sudo apt install -y python3-scipy

Issues Installing pdftotext on MacOS using Anaconda

I am newer to programming and am having trouble installing pdftotext in Anaconda, using Mac OS Mojave 10.14.6 and Python 3.6.7. I have installed all the dependencies recommended (https://github.com/jalan/pdftotext) but have not been able to successfully install pdftotext.
Errors include:
ERROR: Command errored out with exit status 1:
command: /anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/3_/T/pip-install-ak3q4wz7/pdftotext/setup.py'"'"'; __file__='"'"'/private/var/folders/3_/T/pip-install-ak3q4wz7/pdftotext/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 /private/var/folders/3_/T/pip-install-ak3q4wz7/pdftotext/pip-egg-info
cwd: /private/var/folders/3_//T/pip-install-ak3q4wz7/pdftotext/
Complete output (3 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I ended up using pdftotext from poppler instead of the package listed above. This required the installation of poppler using conda-forge in Anaconda.
For Mac:
conda create -n envname python=3.7
conda activate envname
conda config --add channels conda-forge
conda install poppler
ModuleNotFoundError: No module named 'setuptools'
This suggests that you want to install at least one more dependency:
$ conda install setuptools
Or pip install, if you prefer.

Resources