Installing PyQT in conda environment - python

The final goal was to have a working environment with: Tensorflow, numpy, pandas, pyqt5, psycopg2. I successfully installed TF, numpy and pandas but not pyqt5. That's what I did:
Installed X-Code command tools
Installed miniforge
installed Tensorflow via pip:
pip install --upgrade --force --no-dependencies https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl https://github.com/apple/tensorflow_macos/releases/download/v0.1alpha3/tensorflow_addons_macos-0.1a3-cp38-cp38-macosx_11_0_arm64.whl.
4. Installed pandas and numpy.
5. TRIED to install pyqt5 via conda install with:
(1)conda install --name new_env pyqt5
(2)conda install --name new_env -c conda-forge pyqt5
(3)pip install pyqt
(4)pip install pyqt5
But none of that worked out. For commands (1) and (2) came out:
"PackagesNotFoundError: The following packages are not available from current channels:
pyqt
Current channels:
https://conda.anaconda.org/conda-forge/osx-arm64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/osx-arm64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-arm64
https://repo.anaconda.com/pkgs/r/noarch
While for (4) command:
ERROR: Could not find a version that satisfies the requirement pyqt (from versions: none)
ERROR: No matching distribution found for pyqt
and (5):
ERROR: Command errored out with exit status 1:
command: /Users/stefanozimmitti/miniforge3/envs/new_env/bin/python3.8 /Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/tmpmwnbekdr
cwd: /private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-install-cp4t3jsy/pyqt5
Complete output (31 lines):
Traceback (most recent call last):
File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 126, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 130, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "/Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py", line 159, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/sipbuild/api.py", line 51, in build_wheel
project = AbstractProject.bootstrap('pep517')
File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/sipbuild/abstract_project.py", line 83, in bootstrap
project.setup(pyproject, tool, tool_description)
File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 481, in setup
self.apply_user_defaults(tool)
File "project.py", line 63, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/pyqtbuild/project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/sipbuild/project.py", line 227, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "/private/var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/pip-build-env-qeibpe1m/overlay/lib/python3.8/site-packages/pyqtbuild/builder.py", line 66, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/stefanozimmitti/miniforge3/envs/new_env/bin/python3.8 /Users/stefanozimmitti/miniforge3/envs/new_env/lib/python3.8/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/7p/vn4_9dqx69z015z9jy8m3wbh0000gn/T/tmpmwnbekdr Check the logs for full command output.
I tried to be as specific as possible, my final goal was having a working version of Tensorflow on my Mac M1, along with a couple more packages like pandas, numpy, PyQT5 and psycopg2.
I succeded to install Tensorflow, pandas and numpy, need help on PyQt5

Try with
conda update --all
conda install qt
conda install pyqt

I think this should work for the installation of PyQt5.
conda config --add channels conda-forge
conda config --set channel_priority strict
conda install pyqt
This should be done prior to using pip, as stated here.

Related

I tried installing PyQt5==5.15.6 and keep facing this issue

I tried installing PyQt5==5.15.6 and this error keeps showing repeatedly:
Collecting PyQt5==5.15.6 (from -r requirements.txt (line 6))
Using cached https://files.pythonhosted.org/packages/3b/27/fd81188a35f37be9b3b4c2db1654d9439d1418823916fe702ac3658c9c41/PyQt5-5.15.6.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\clens\appdata\local\programs\python\python38\python.exe' 'c:\users\clens\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\pep517_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\clens\AppData\Local\Temp\tmpf4m7pu7d'
cwd: C:\Users\clens\AppData\Local\Temp\pip-install-71rwmvce\PyQt5
Complete output (31 lines):
Traceback (most recent call last):
File "c:\users\clens\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\pep517_in_process.py", line 64, in prepare_metadata_for_build_wheel
hook = backend.prepare_metadata_for_build_wheel
AttributeError: module 'sipbuild.api' has no attribute 'prepare_metadata_for_build_wheel'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\clens\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 207, in <module>
main()
File "c:\users\clens\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 197, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "c:\users\clens\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 66, in prepare_metadata_for_build_wheel
return _get_wheel_metadata_from_wheel(backend, metadata_directory,
File "c:\users\clens\appdata\local\programs\python\python38\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 95, in _get_wheel_metadata_from_wheel
whl_basename = backend.build_wheel(metadata_directory, config_settings)
File "C:\Users\clens\AppData\Local\Temp\pip-build-env-12b0td49\overlay\Lib\site-packages\sipbuild\api.py", line 46, in build_wheel
project = AbstractProject.bootstrap('wheel',
File "C:\Users\clens\AppData\Local\Temp\pip-build-env-12b0td49\overlay\Lib\site-packages\sipbuild\abstract_project.py", line 87, in bootstrap
project.setup(pyproject, tool, tool_description)
File "C:\Users\clens\AppData\Local\Temp\pip-build-env-12b0td49\overlay\Lib\site-packages\sipbuild\project.py", line 585, in setup
self.apply_user_defaults(tool)
File "project.py", line 63, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\clens\AppData\Local\Temp\pip-build-env-12b0td49\overlay\Lib\site-packages\pyqtbuild\project.py", line 70, in apply_user_defaults
super().apply_user_defaults(tool)
File "C:\Users\clens\AppData\Local\Temp\pip-build-env-12b0td49\overlay\Lib\site-packages\sipbuild\project.py", line 236, in apply_user_defaults
self.builder.apply_user_defaults(tool)
File "C:\Users\clens\AppData\Local\Temp\pip-build-env-12b0td49\overlay\Lib\site-packages\pyqtbuild\builder.py", line 69, in apply_user_defaults
raise PyProjectOptionException('qmake',
sipbuild.pyproject.PyProjectOptionException
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\clens\appdata\local\programs\python\python38\python.exe' 'c:\users\clens\appdata\local\programs\python\python38\lib\site-packages\pip_vendor\pep517_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\clens\AppData\Local\Temp\tmpf4m7pu7d' Check the logs for full command output.
I was trying to install requirements file with the command pip install -r requirements.txt but this error keeps coming up
I had the same problem and finally got it working by simply downgrading to Python 3.9.13. It must not be implemented in Python 3.11 yet.
None of the suggested answers in previous threads worked for me (upgrading pip or specifying any pyqt version).
To downgrade Python,
Install virtualenv (pip install virtualenv)
Download a previous Python release on the official website (do not add to path!)
Create a virtualenv using the newly installed Python version: virtualenv path\to\virtualenv -p path\to\new\python.exe
Activate the virtualenv: path\to\virtualenv\Scripts\Activate
Then, reinstall pyqt5 and pyqt5-tools with pip (in this active virtualenv), and it should work.

installing python module on linux

I am trying to install the python module pyobjus (this is the one that fails to install another module).
But I always get some bug during installation. I tried to switch to other python versions, reinstall pip, use option --no-cache-dir, etc, but couldn't manage to get past this bug:
$ pip3 install pyobjus
Defaulting to user installation because normal site-packages is not writeable
Collecting pyobjus
Using cached pyobjus-1.2.0.tar.gz (165 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /home/denis/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpoff64vmf
cwd: /tmp/pip-install-4k26drr5/pyobjus
Complete output (19 lines):
Pyobjus platform is linux
Traceback (most recent call last):
File "/home/denis/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 280, in <module>
main()
File "/home/denis/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/home/denis/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py", line 114, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-35d2l6hi/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 150, in get_requires_for_build_wheel
config_settings, requirements=['wheel'])
File "/tmp/pip-build-env-35d2l6hi/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 130, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-35d2l6hi/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 254, in run_setup
self).run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-35d2l6hi/overlay/lib/python3.6/site-packages/setuptools/build_meta.py", line 145, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 35, in <module>
class PyObjusBuildExt(build_ext, object):
NameError: name 'build_ext' is not defined
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 /home/denis/.local/lib/python3.6/site-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmpoff64vmf Check the logs for full command output.
Any help would be greatly appreciated.
My OS is Linux Mint 19.3.
I saw this question which is about the same problem, but following the links did not bring any answer. It says PyObjus is designed for MacOS, but then why does the module katrain, supposedly compatible with linux, tries to install it when running "pip3 install katrain" (giving the same error as above) ?
Edit adter Marat's suggestion:
I removed the test for ios, the installation goes a bit further, but fails because Python.h is missing. when trying to install python3-dev, apt-get says that broken packages such as python3.6-dev are flagged "left as is", so it cannot install the required ones. Is there a way to fix the python installation, which seems to be broken ? I am afraid to break all the system if I mess up with it too much, but there is clearly a problem with my installation...
Fixed the above issue by reinstalling stuff, now it is CoreFoundation.h that is missing...

Error when I try to install matplotlib on my Mac for Python [duplicate]

OS: Windows 10
Python ver: 3.9.0
Error code:
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I tried:
python -m pip install -U pip
python -m pip install -U matplotlib
didn't work.
and then I tried:
pip install --upgrade setuptools
didn't solve the problem.
I read on SO that maybe if I open the shell in administrator mode it could solve the problem but it didn't work too.
I saw someone mentioning ez-setup for this error code. I installed it but that didn't work too.
I don't know if it has something to do but my C directory looks like this:
C:\Users\METİNUSTA
It has an uppercase i character which sometimes can cause problems with applications. I can't change it because I am using my school's Windows key and it don't let me do any change. Because of this I installed python on D: .
Also here my pip list for extra information:
ez-setup 0.9
flake8 3.8.4
mccabe 0.6.1
pip 20.2.4
pycodestyle 2.6.0
pyflakes 2.2.0
setuptools 50.3.2
wheel 0.35.1
and finally whole error log that I get on windows powershell:
ERROR: Command errored out with exit status 1:
command: 'd:\python\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\METİNUSTA\\AppData\\Local\\Temp\\pip-install-8iv10tb_\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\METİNUSTA\\AppData\\Local\\Temp\\pip-install-8iv10tb_\\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 'C:\Users\METİNUSTA\AppData\Local\Temp\pip-pip-egg-info-elosrn6m'
cwd: C:\Users\METİNUSTA\AppData\Local\Temp\pip-install-8iv10tb_\matplotlib\
Complete output (99 lines):
WARNING: Missing build requirements in pyproject.toml for numpy>=1.15 from https://files.pythonhosted.org/packages/bf/e8/15aea783ea72e2d4e51e3ec365e8dc4a1a32c9e5eb3a6d695b0d58e67cdd/numpy-1.19.2.zip#sha256=0d310730e1e793527065ad7dde736197b705d0e4c9999775f212b03c44a8484c.
WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'setuptools>=40.8.0' and 'wheel'.
ERROR: Command errored out with exit status 1:
command: 'd:\python\python39\python.exe' 'd:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\METNUS~1\AppData\Local\Temp\tmpqz3brme_'
cwd: C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy
Complete output (49 lines):
Error in sitecustomize; set PYTHONVERBOSE for traceback:
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xdd in position 0: unexpected end of data (sitecustomize.py, line 21)
Running from numpy source directory.
setup.py:470: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
Error in sitecustomize; set PYTHONVERBOSE for traceback:
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xdd in position 0: unexpected end of data (sitecustomize.py, line 21)
Processing numpy/random\_bounded_integers.pxd.in
Processing numpy/random\bit_generator.pyx
Traceback (most recent call last):
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 59, in process_pyx
from Cython.Compiler.Version import version as cython_version
ModuleNotFoundError: No module named 'Cython'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 235, in <module>
main()
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 231, in main
find_process_files(root_dir)
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 222, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 188, in process
processor_function(fromfile, tofile)
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 64, in process_pyx
raise OSError('Cython needs to be installed in Python as a module')
OSError: Cython needs to be installed in Python as a module
Cythonizing sources
Traceback (most recent call last):
File "d:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
main()
File "d:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "d:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "d:\python\python39\lib\site-packages\setuptools\build_meta.py", line 161, in prepare_metadata_for_build_wheel
self.run_setup()
File "d:\python\python39\lib\site-packages\setuptools\build_meta.py", line 253, in run_setup
super(_BuildMetaLegacyBackend,
File "d:\python\python39\lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 499, in <module>
setup_package()
File "setup.py", line 479, in setup_package
generate_cython()
File "setup.py", line 274, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!
----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\python\python39\python.exe' 'd:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\METNUS~1\AppData\Local\Temp\tmpqz3brme_' Check the logs for full command output.
Traceback (most recent call last):
File "d:\python\python39\lib\site-packages\setuptools\installer.py", line 126, in fetch_build_egg
subprocess.check_call(cmd)
File "d:\python\python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['d:\\python\\python39\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\METNUS~1\\AppData\\Local\\Temp\\tmppoh8r2c9', '--quiet', 'numpy>=1.15']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-install-8iv10tb_\matplotlib\setup.py", line 242, in <module>
setup( # Finally, pass this all along to distutils to do the heavy lifting.
File "d:\python\python39\lib\site-packages\setuptools\__init__.py", line 152, in setup
_install_setup_requires(attrs)
File "d:\python\python39\lib\site-packages\setuptools\__init__.py", line 147, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "d:\python\python39\lib\site-packages\setuptools\dist.py", line 673, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "d:\python\python39\lib\site-packages\pkg_resources\__init__.py", line 764, in resolve
dist = best[req.key] = env.best_match(
File "d:\python\python39\lib\site-packages\pkg_resources\__init__.py", line 1049, in best_match
return self.obtain(req, installer)
File "d:\python\python39\lib\site-packages\pkg_resources\__init__.py", line 1061, in obtain
return installer(requirement)
File "d:\python\python39\lib\site-packages\setuptools\dist.py", line 732, in fetch_build_egg
return fetch_build_egg(self, req)
File "d:\python\python39\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['d:\\python\\python39\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\METNUS~1\\AppData\\Local\\Temp\\tmppoh8r2c9', '--quiet', 'numpy>=1.15']' returned non-zero exit status 1.
Edit setup.cfg to change the build options; suppress output with --quiet.
BUILDING MATPLOTLIB
matplotlib: yes [3.3.2]
python: yes [3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC
v.1927 64 bit (AMD64)]]
platform: yes [win32]
sample_data: yes [installing]
tests: no [skipping due to configuration]
macosx: no [Mac OS-X only]
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
python -m pip install --upgrade pip
pip install matplotlib==3.3.1
Worked for me.
edit: matplotlib has now released wheels for python 3.9 so pip install --upgrade matplotlib should work.
original answer
matplotlib hasn't made a wheel yet for version 3.9 so your python attempted to build it from source. You should downgrade to python 3.8 and then everything should work
This is because matplotlib has no 3.9 wheels ..
For convenience in the use of matplotlib, you can install anaconda.
In anaconda environment matplotlib, numpy and pandas are available by default for Python installed in Anaconda.
Or you can use lower versions of Python.
Install it from the source (Python >= 3.9.2):
git clone git://github.com/matplotlib/matplotlib.git
and build and install with:
cd matplotlib
python -mpip install .
If you want to be able to follow the development branch as it changes just replace the last step with:
python -mpip install -e .
Source and more information here: https://matplotlib.org/stable/faq/installing_faq.html#install-from-git
Matplotlib has no wheel for python version 3.10.
If tried installing matplotlib in 3.10 version of python by
pip install matplotlib
Results in : Error: Building wheel for matplotlib (setup.py)..error
Matplotlib dependencies are met and they are as follow:
cycler = 0.10
kiwisolver = 1.0.1
numpy = 1.16
pillow = 6.2.0
pyparsing = 2.2.1
six = 1.5
python-dateutil = 2.7
Tried upgrading pip and install matplotlib
python -m pip install -U pip
python -m pip install -U matplotlib
Successfully installed pip-21.3.1
again it didn't install Matplotlib.
Hence Down-versioned Python to 3.9 and installed Matplotlib. For Python version upto 3.9 wheel is defined for Matplotlib, do use Python 3.9 and make sure pip is upgraded to available version it wont be problem to install matplotlib

Python, Error while installing matplotlib

OS: Windows 10
Python ver: 3.9.0
Error code:
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
I tried:
python -m pip install -U pip
python -m pip install -U matplotlib
didn't work.
and then I tried:
pip install --upgrade setuptools
didn't solve the problem.
I read on SO that maybe if I open the shell in administrator mode it could solve the problem but it didn't work too.
I saw someone mentioning ez-setup for this error code. I installed it but that didn't work too.
I don't know if it has something to do but my C directory looks like this:
C:\Users\METİNUSTA
It has an uppercase i character which sometimes can cause problems with applications. I can't change it because I am using my school's Windows key and it don't let me do any change. Because of this I installed python on D: .
Also here my pip list for extra information:
ez-setup 0.9
flake8 3.8.4
mccabe 0.6.1
pip 20.2.4
pycodestyle 2.6.0
pyflakes 2.2.0
setuptools 50.3.2
wheel 0.35.1
and finally whole error log that I get on windows powershell:
ERROR: Command errored out with exit status 1:
command: 'd:\python\python39\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\METİNUSTA\\AppData\\Local\\Temp\\pip-install-8iv10tb_\\matplotlib\\setup.py'"'"'; __file__='"'"'C:\\Users\\METİNUSTA\\AppData\\Local\\Temp\\pip-install-8iv10tb_\\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 'C:\Users\METİNUSTA\AppData\Local\Temp\pip-pip-egg-info-elosrn6m'
cwd: C:\Users\METİNUSTA\AppData\Local\Temp\pip-install-8iv10tb_\matplotlib\
Complete output (99 lines):
WARNING: Missing build requirements in pyproject.toml for numpy>=1.15 from https://files.pythonhosted.org/packages/bf/e8/15aea783ea72e2d4e51e3ec365e8dc4a1a32c9e5eb3a6d695b0d58e67cdd/numpy-1.19.2.zip#sha256=0d310730e1e793527065ad7dde736197b705d0e4c9999775f212b03c44a8484c.
WARNING: The project does not specify a build backend, and pip cannot fall back to setuptools without 'setuptools>=40.8.0' and 'wheel'.
ERROR: Command errored out with exit status 1:
command: 'd:\python\python39\python.exe' 'd:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\METNUS~1\AppData\Local\Temp\tmpqz3brme_'
cwd: C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy
Complete output (49 lines):
Error in sitecustomize; set PYTHONVERBOSE for traceback:
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xdd in position 0: unexpected end of data (sitecustomize.py, line 21)
Running from numpy source directory.
setup.py:470: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
Error in sitecustomize; set PYTHONVERBOSE for traceback:
SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xdd in position 0: unexpected end of data (sitecustomize.py, line 21)
Processing numpy/random\_bounded_integers.pxd.in
Processing numpy/random\bit_generator.pyx
Traceback (most recent call last):
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 59, in process_pyx
from Cython.Compiler.Version import version as cython_version
ModuleNotFoundError: No module named 'Cython'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 235, in <module>
main()
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 231, in main
find_process_files(root_dir)
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 222, in find_process_files
process(root_dir, fromfile, tofile, function, hash_db)
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 188, in process
processor_function(fromfile, tofile)
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-wheel-l2wpf1i8\numpy\tools\cythonize.py", line 64, in process_pyx
raise OSError('Cython needs to be installed in Python as a module')
OSError: Cython needs to be installed in Python as a module
Cythonizing sources
Traceback (most recent call last):
File "d:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 280, in <module>
main()
File "d:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 263, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "d:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py", line 133, in prepare_metadata_for_build_wheel
return hook(metadata_directory, config_settings)
File "d:\python\python39\lib\site-packages\setuptools\build_meta.py", line 161, in prepare_metadata_for_build_wheel
self.run_setup()
File "d:\python\python39\lib\site-packages\setuptools\build_meta.py", line 253, in run_setup
super(_BuildMetaLegacyBackend,
File "d:\python\python39\lib\site-packages\setuptools\build_meta.py", line 145, in run_setup
exec(compile(code, __file__, 'exec'), locals())
File "setup.py", line 499, in <module>
setup_package()
File "setup.py", line 479, in setup_package
generate_cython()
File "setup.py", line 274, in generate_cython
raise RuntimeError("Running cythonize failed!")
RuntimeError: Running cythonize failed!
----------------------------------------
ERROR: Command errored out with exit status 1: 'd:\python\python39\python.exe' 'd:\python\python39\lib\site-packages\pip\_vendor\pep517\_in_process.py' prepare_metadata_for_build_wheel 'C:\Users\METNUS~1\AppData\Local\Temp\tmpqz3brme_' Check the logs for full command output.
Traceback (most recent call last):
File "d:\python\python39\lib\site-packages\setuptools\installer.py", line 126, in fetch_build_egg
subprocess.check_call(cmd)
File "d:\python\python39\lib\subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['d:\\python\\python39\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\METNUS~1\\AppData\\Local\\Temp\\tmppoh8r2c9', '--quiet', 'numpy>=1.15']' returned non-zero exit status 1.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\METİNUSTA\AppData\Local\Temp\pip-install-8iv10tb_\matplotlib\setup.py", line 242, in <module>
setup( # Finally, pass this all along to distutils to do the heavy lifting.
File "d:\python\python39\lib\site-packages\setuptools\__init__.py", line 152, in setup
_install_setup_requires(attrs)
File "d:\python\python39\lib\site-packages\setuptools\__init__.py", line 147, in _install_setup_requires
dist.fetch_build_eggs(dist.setup_requires)
File "d:\python\python39\lib\site-packages\setuptools\dist.py", line 673, in fetch_build_eggs
resolved_dists = pkg_resources.working_set.resolve(
File "d:\python\python39\lib\site-packages\pkg_resources\__init__.py", line 764, in resolve
dist = best[req.key] = env.best_match(
File "d:\python\python39\lib\site-packages\pkg_resources\__init__.py", line 1049, in best_match
return self.obtain(req, installer)
File "d:\python\python39\lib\site-packages\pkg_resources\__init__.py", line 1061, in obtain
return installer(requirement)
File "d:\python\python39\lib\site-packages\setuptools\dist.py", line 732, in fetch_build_egg
return fetch_build_egg(self, req)
File "d:\python\python39\lib\site-packages\setuptools\installer.py", line 128, in fetch_build_egg
raise DistutilsError(str(e)) from e
distutils.errors.DistutilsError: Command '['d:\\python\\python39\\python.exe', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', 'C:\\Users\\METNUS~1\\AppData\\Local\\Temp\\tmppoh8r2c9', '--quiet', 'numpy>=1.15']' returned non-zero exit status 1.
Edit setup.cfg to change the build options; suppress output with --quiet.
BUILDING MATPLOTLIB
matplotlib: yes [3.3.2]
python: yes [3.9.0 (tags/v3.9.0:9cf6752, Oct 5 2020, 15:34:40) [MSC
v.1927 64 bit (AMD64)]]
platform: yes [win32]
sample_data: yes [installing]
tests: no [skipping due to configuration]
macosx: no [Mac OS-X only]
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
python -m pip install --upgrade pip
pip install matplotlib==3.3.1
Worked for me.
edit: matplotlib has now released wheels for python 3.9 so pip install --upgrade matplotlib should work.
original answer
matplotlib hasn't made a wheel yet for version 3.9 so your python attempted to build it from source. You should downgrade to python 3.8 and then everything should work
This is because matplotlib has no 3.9 wheels ..
For convenience in the use of matplotlib, you can install anaconda.
In anaconda environment matplotlib, numpy and pandas are available by default for Python installed in Anaconda.
Or you can use lower versions of Python.
Install it from the source (Python >= 3.9.2):
git clone git://github.com/matplotlib/matplotlib.git
and build and install with:
cd matplotlib
python -mpip install .
If you want to be able to follow the development branch as it changes just replace the last step with:
python -mpip install -e .
Source and more information here: https://matplotlib.org/stable/faq/installing_faq.html#install-from-git
Matplotlib has no wheel for python version 3.10.
If tried installing matplotlib in 3.10 version of python by
pip install matplotlib
Results in : Error: Building wheel for matplotlib (setup.py)..error
Matplotlib dependencies are met and they are as follow:
cycler = 0.10
kiwisolver = 1.0.1
numpy = 1.16
pillow = 6.2.0
pyparsing = 2.2.1
six = 1.5
python-dateutil = 2.7
Tried upgrading pip and install matplotlib
python -m pip install -U pip
python -m pip install -U matplotlib
Successfully installed pip-21.3.1
again it didn't install Matplotlib.
Hence Down-versioned Python to 3.9 and installed Matplotlib. For Python version upto 3.9 wheel is defined for Matplotlib, do use Python 3.9 and make sure pip is upgraded to available version it wont be problem to install matplotlib

Cannot install Tensorflow in Python

I'm running python 3.5.3 on Windows
I tried using
pip install --upgrade tensorflow
and here's what i get back
Using cached tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
Requirement already up-to-date: wheel>=0.26 in
c:\users\max\miniconda3\lib\site-packages (from tensorflow)
Exception:
Traceback (most recent call last):
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\basecommand.py", line
215, in main
status = self.run(options, args)
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\commands\install.py", line 335, in run
wb.build(autobuilding=True)
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\wheel.py", line 749, in build
self.requirement_set.prepare_files(self.finder)
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\req\req_set.py", line 380, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\req\req_set.py", line 666, in _prepare_file
check_dist_requires_python(dist)
File "C:\Users\Max\Miniconda3\lib\site-packages\pip\utils\packaging.py", line 48, in check_dist_requires_python
feed_parser.feed(metadata)
File "C:\Users\Max\Miniconda3\lib\email\feedparser.py", line 178, in feed
self._input.push(data)
File "C:\Users\Max\Miniconda3\lib\email\feedparser.py", line 104, in push
self._partial.write(data)
TypeError: string argument expected, got 'NoneType'
I've also tried
pip3 install --upgrade tensorflow
but I get back
'pip3' is not recognized as an internal or external command, operable program or batch file.
I'm not too sure what the error is, and googling hasn't gotten me any results
I also had the same issue. I'm using Anaconda, and I managed to install it with these commands:
conda create -n tensorflow
activate tensorflow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-1.0.1-cp35-cp35m-win_amd64.whl
This worked for me, and probably this will work for miniconda too.

Categories