I am using Python 3.8 in conda, and using build to create packages. Although in my Conda env I already have setuptools 51.0 and wheel 0.36, everytime I run python -m build --wheel I see the following messages:
Found existing installation: setuptools 49.2.1
Uninstalling setuptools-49.2.1:
Successfully uninstalled setuptools-49.2.1
Collecting wheel
Using cached wheel-0.37.0-py2.py3-none-any.whl (35 kB)
Collecting setuptools>=51
Using cached setuptools-58.3.0-py3-none-any.whl (946 kB)
Installing collected packages: wheel, setuptools
Successfully installed setuptools-58.3.0 wheel-0.37.0
Here the existing packages don't even match what I have in Conda, and I don't think I need the newest packages either. Could anyone explain why this is happening?
refer to this topic https://pypa-build.readthedocs.io/en/latest/#python--m-build-optional-arguments
By default build will build the package in an isolated environment, but this behavior can be disabled with --no-isolation.
so you may need to add --no-isolation flag to force using your project's virtual environment like so:
python -m build --wheel --no-isolation
Related
I am updating PyGObject and give an error.
How should I update PyGObject
.....
Environment:
macOS Big Sur 11.5.2
python --version
Python 3.9.7
pip --version
pip 21.2.4 from /usr/local/lib/python3.9/site-packages/pip (python 3.9)
my operation.
ERROR: Cannot uninstall 'PyGObject'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
pip install --upgrade PyGObject
DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621
Requirement already satisfied: PyGObject in /usr/local/lib/python3.9/site-packages (3.40.1)
Collecting PyGObject
Using cached PyGObject-3.42.0-cp39-cp39-macosx_11_0_x86_64.whl
Requirement already satisfied: pycairo>=1.16.0 in /usr/local/lib/python3.9/site-packages (from PyGObject) (1.20.1)
Installing collected packages: PyGObject
Attempting uninstall: PyGObject
Found existing installation: PyGObject 3.40.1
ERROR: Cannot uninstall 'PyGObject'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
Pip is unsure on the package dependencies to clean up in the upgrade. You can force the upgrade by telling it to ignore what is already installed.
pip install PyGObject --ignore-installed
The problem is like following one.
In some machines, I can't install django with pip. (not only django, but also numpy and so on...)
$ pip install --no-cache-dir django
Collecting django
Downloading Django-3.1.7-py3-none-any.whl (7.8 MB)
|????????????????????????????????| 7.8 MB 5.6 MB/s
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
django from https://files.pythonhosted.org/packages/b8/6f/9a4415cc4fe9228e26ea53cf2005961799b2abb8da0411e519fdb74754fa/Django-3.1.7-py3-none-any.whl#sha256=baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8:
Expected sha256 baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8
Got 7140cf41703d27896793ef3ca9f79323d12eac477f8cea29c79c76a7f17379f1
I checked the some articles in stackoverflow and noticed that there are many questions concerning this problem.
Learning from those articles, then I'm struggling.
By the way, in stackoverflow, I found the answer which says this problem is likely to be the issue of the pip.
Please refer to https://stackoverflow.com/a/61731528/8674852.
So I tried installing in the machine with old pip, then I have succeeded to install django with pip.
It is the pip 20.3.3.
Succeeded
$ pip --version
pip 20.3.3 from /home/user/.local/lib/python3.6/site-packages/pip (python 3.6)
$ pip install django
Defaulting to user installation because normal site-packages is not writeable
Collecting django
Downloading Django-3.1.7-py3-none-any.whl (7.8 MB)
|????????????????????????????????| 7.8 MB 2.8 MB/s
Collecting asgiref<4,>=3.2.10
Using cached asgiref-3.3.1-py3-none-any.whl (19 kB)
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.4.1-py3-none-any.whl (42 kB)
Collecting pytz
Downloading pytz-2021.1-py2.py3-none-any.whl (510 kB)
|????????????????????????????????| 510 kB 3.0 MB/s
Installing collected packages: sqlparse, pytz, asgiref, django
Successfully installed asgiref-3.3.1 django-3.1.7 pytz-2021.1 sqlparse-0.4.1
WARNING: You are using pip version 20.3.3; however, version 21.0.1 is available.
You should consider upgrading via the '/usr/bin/python3 -m pip install --upgrade pip' command.
Failed
But the other machine with pip 21.0.1 failed to install django.
$ pip --version
pip 21.0.1 from /home/user/.pyenv/versions/3.8.8/lib/python3.8/site-packages/pip (python 3.8)
$ pip install django
Collecting django
Using cached Django-3.1.7-py3-none-any.whl (7.8 MB)
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
django from https://files.pythonhosted.org/packages/b8/6f/9a4415cc4fe9228e26ea53cf2005961799b2abb8da0411e519fdb74754fa/Django-3.1.7-py3-none-any.whl#sha256=baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8:
Expected sha256 baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8
Got 7c5af478cb5c9748d0477912637f98da101a0e7be763b61c71c053e0cc98fa08
But ...., In this machine, even if I downgraded pip into 20.0.2 or 20.3.3, the result didn't changed, installing failed.
$ pip install pip==20.0.2
Collecting pip==20.0.2
Downloading pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
|????????????????????????????????| 1.4 MB 3.1 MB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.0.1
Uninstalling pip-21.0.1:
Successfully uninstalled pip-21.0.1
Successfully installed pip-20.0.2
$ pip install --no-cache-dir django
Collecting django
Downloading Django-3.1.7-py3-none-any.whl (7.8 MB)
|????????????????????????????????| 7.8 MB 6.4 MB/s
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
django from https://files.pythonhosted.org/packages/b8/6f/9a4415cc4fe9228e26ea53cf2005961799b2abb8da0411e519fdb74754fa/Django-3.1.7-py3-none-any.whl#sha256=baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8:
Expected sha256 baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8
Got ba57de6ac1d02039af8ce41e9af8663fd9fb6b62db55870b9b1e6eabe5c1ff73
WARNING: You are using pip version 20.0.2; however, version 21.0.1 is available.
You should consider upgrading via the '/home/user/.pyenv/versions/3.8.8/bin/python3.8 -m pip install --upgrade pip' command.
Environment
By the way, all of the above execution of commands was done in the same host PC.
But I tried pip install django in several different environments in the same host PC.
pip
Guest OS
Virtualmechanism
Host OS
Specifiedversion
Result
20.3.3
Ubuntu18
virtualbox
windows10
null
success
20.3.3
Ubuntu18
virtualbox
same with above
3.1.7
success
21.0.1
Ubuntu20
WSL2
same with above
null
success
21.0.1
Ubuntu20
WSL2
same with above
3.1.7
success
20.0.2
CentOS7
virtualbox
same with above
null
fail
20.0.2
CentOS7
virtualbox
same with above
3.1.7
fail
20.3.3
CentOS7
virtualbox
same with above
null
fail
20.3.3
CentOS7
virtualbox
same with above
3.1.7
fail
21.0.1
CentOS7
virtualbox
same with above
null
fail
21.0.1
Ubuntu18(different from above)
virtualbox
same with above
null
fail
21.0.1
Debian GNU/Linux 10 (buster)
docker
ubuntu18 on windows10
null
fail
21.0.1
Debian GNU/Linux 10 (buster)
docker
ubuntu18 on windows10
3.1.7
fail
* To specify version I executed $ pip install django==3.1.7 and pip install --no-cache-dir django==3.1.7
Question
Why these problem occurs ?
Is the cause of this problem the network configuration ?
Is there anything I could do for finding the solution ?
Memo
One committer for the pip said
it sounds like a network configuration problem on your production server
Please refer to pypa/pip : package installation issue on the server-THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE #8510
But no one knows what kind of network configuration effects against the hash.
Could you tell me how I can investigate the cause network configuration?
There is also other answer saying it is the problem of https://pywheels.org/.
Please refer to https://stackoverflow.com/a/52407348/8674852.
But...., at least, though it is not everytime, I succeeded to execute pip install django.
So, I'm not sure but I think https://pywheels.org/ isn't the cause of this problem at now.
About other module
pip can't install not only django, but also numpy in above failed environment.
This is the sample of the result executed in docker container.
# in this container, I executed `pip install numpy --no-cache-dir`
web_1 | Requirement already satisfied: pip in /usr/local/lib/python3.8/site-packages (21.0.1)
web_1 | Collecting numpy
web_1 | Downloading numpy-1.20.2-cp38-cp38-manylinux2010_x86_64.whl (15.4 MB)
web_1 | ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM THE REQUIREMENTS FILE. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.
web_1 | numpy from https://files.pythonhosted.org/packages/75/f6/60e7d3a1da53a9979f37931d3cc619211accb339df06af8b387889b8d6ba/numpy-1.20.2-cp38-cp38-manylinux2010_x86_64.whl#sha256=edb1f041a9146dcf02cd7df7187db46ab524b9af2515f392f337c7cbbf5b52cd:
web_1 | Expected sha256 edb1f041a9146dcf02cd7df7187db46ab524b9af2515f392f337c7cbbf5b52cd
web_1 | Got ea51c3b37824f3efff5ad03076fdeb6d802e153664ec73599054a006262105a5
Besides, I couldn't even downgrade pip in docker container which failed to install django 3.1.7.
So whenever I try to install anything pip throws this error:
DEVICE_NAME:~ MY_NAME$ sudo pip install pyautogui
Password:
The directory '/Users/daankoning/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/daankoning/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pyautogui
Downloading https://files.pythonhosted.org/packages/2e/83/89b5adbc37d1bbf7b486a2c1c00e8037e6f801e8c053c4897bb82d9510c6/PyAutoGUI-0.9.36.tar.gz (46kB)
100% |████████████████████████████████| 51kB 1.3MB/s
Collecting pymsgbox (from pyautogui)
Downloading https://files.pythonhosted.org/packages/b6/65/86379ede1db26c40e7972d7a41c69cdf12cc6a0f143749aabf67ab8a41a1/PyMsgBox-1.0.6.zip
Collecting PyTweening>=1.0.1 (from pyautogui)
Downloading https://files.pythonhosted.org/packages/b9/f8/c32a58d6e4dff8aa5c27e907194d69f3b57e525c2e4af96f39c6e9c854d2/PyTweening-1.0.3.zip
Collecting Pillow (from pyautogui)
Downloading https://files.pythonhosted.org/packages/df/aa/a25f211a4686f363d8ca5a1752c43a8f42459e70af13e20713d3e636f0af/Pillow-5.1.0-cp27-cp27m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.6MB)
100% |████████████████████████████████| 3.6MB 3.5MB/s
Collecting pyscreeze (from pyautogui)
Downloading https://files.pythonhosted.org/packages/9e/ec/e625b7c4f496977eafc441cd1f71becc8436a4ff0714263b885d269d866a/PyScreeze-0.1.14.tar.gz
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
matplotlib 1.3.1 has requirement numpy>=1.5, but you'll have numpy 1.8.0rc1 which is incompatible.
Installing collected packages: pymsgbox, PyTweening, Pillow, pyscreeze, pyautogui
Running setup.py install for pymsgbox ... done
Running setup.py install for PyTweening ... done
Running setup.py install for pyscreeze ... done
Running setup.py install for pyautogui ... done
Successfully installed Pillow-5.1.0 PyTweening-1.0.3 pyautogui-0.9.36 pymsgbox-1.0.6 pyscreeze-0.1.14
You are using pip version 10.0.0b2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
and when I then type pip install --upgrade pip it throws the same error. I've tried reinstalling pip thrice over already and I'm completely out of ideas as to what I can do.
It also does this when I try to install any other package, not jus pyautogui.
Please note that this is only on my OSX machine whilst on my PC it works perfectly fine.
There is always the option downloading a .whl-file and install it with
pip install /some-dir/some-file.whl
I have the same problems as you have with Py 3.4, so i just use Py 3.5. But I know there is no Version of PyAutoGui for 3.x. You can install this package per wheel, and if it is only this package, this'd be ok... Obviously, it does do Pillow...
I am getting an error while attempting to use Pyinstaller. After doing some research I believe the error is caused by a bug in the most recent version of setuptools (19.3). The fix seems to be downgrading to setuptools version 19.2. My issue is with the downgrade itself. My question is how does one downgrade setuptools in Ubuntu 15.04?
Just specify the version using pip:
pip install setuptools==19.2
If you are installing globally you will obviously need sudo.
~$ sudo pip install setuptools==19.2
Collecting setuptools==19.2
Downloading setuptools-19.2-py2.py3-none-any.whl (463kB)
100% |████████████████████████████████| 466kB 486kB/s
Installing collected packages: setuptools
Found existing installation: setuptools 19.1
Uninstalling setuptools-19.1:
Successfully uninstalled setuptools-19.1
Successfully installed setuptools-19.2
~$ sudo pip install setuptools==19.1
Collecting setuptools==19.1
Downloading setuptools-19.1-py2.py3-none-any.whl (463kB)
100% |████████████████████████████████| 466kB 377kB/s
Installing collected packages: setuptools
Found existing installation: setuptools 19.2
Uninstalling setuptools-19.2:
Successfully uninstalled setuptools-19.2
Successfully installed setuptools-19.1
"Python Xlib" ( http://pypi.python.org/pypi/Python%20Xlib ) is a low level python library for working with xlib. I have installed it on my Ubuntu Linux machine via apt, i.e. sudo aptitude install python-xlib. However is it possible to install it with pip in a virtualenv? I am writing a software package that uses xlib, and would like to be able to include an install_requires line in my setup.py.
Since the package is on PyPI (and appears in results of pip search xlib), I tried to pip install … the following package names but nothing worked: python\ xlib, python-xlib, Python Xlib, Python-Xlib, Python%20Xlib, but none worked.
`
Is it possible to install python xlib with pip?
sudo pip install svn+https://svn.code.sf.net/p/python-xlib/code/trunk/
Worked for me.
pip3 install python3-xlib
and
pip3 install python-xlib
When we run this command from the terminal, we can easily install it:
Collecting python3-xlib
Downloading https://files.pythonhosted.org/packages/ef/c6/2c5999de3bb1533521f1101e8fe56fd9c266732f4d48011c7c69b29d12ae/python3-xlib-0.15.tar.gz (132kB)
|████████████████████████████████| 133kB 1.3MB/s
Installing collected packages: python3-xlib
Running setup.py install for python3-xlib ... done
Successfully installed python3-xlib-0.15
GeorgeGentlys-Mac-mini:~ georgegently$ pip3 install python-xlib
Collecting python-xlib
Downloading https://files.pythonhosted.org/packages/f7/91/9f794491d1a8b810a9d4bb8fc9766a98354cb62bd6990685032b00f87001/python_xlib-0.25-py2.py3-none-any.whl (165kB)
|████████████████████████████████| 174kB 1.3MB/s
Collecting six>=1.10.0 (from python-xlib)
Downloading https://files.pythonhosted.org/packages/73/fb/00a976f728d0d1fecfe898238ce23f502a721c0ac0ecfedb80e0d88c64e9/six-1.12.0-py2.py3-none-any.whl
Installing collected packages: six, python-xlib
Successfully installed python-xlib-0.25 six-1.12.0```