I cannot install Django in my Virtual Environment - python

I wanted to install Django in my virtual environment (which was completely working), but got this whole lot of errors. Anyone know what to do?
I just typed this in PowerShell:
pipenv install django
And got this:
Error: An error occurred while installing django!
Error text: Collecting django
Using cached Django-3.1.7-py3-none-any.whl (7.8 MB)
ERROR: THESE PACKAGES DO NOT MATCH THE HASHES FROM Pipfile.lock!. 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 (from -r c:\users\vojtěch\appdata\local\temp\pipenv-e9otm_0m-requirements\pipenv-sj4h6g3_-requirement.txt (line 1)):
Expected sha256 baf099db36ad31f970775d0be5587cc58a6256a6771a44eb795b554d45f211b8
Got 764ad5e659cd3a7740b314806b39c67501c6136a21d23652515df3bfb4023d76

It looks like your original download may have failed, and pip is using the cached download instead of getting a new one. Try pipenv lock --clear and then pipenv install django again.

Related

Can't update Duplicity in Python 3.9.7 (Requested duplicity has inconsistent version: filename has '0.8.21.post7', but metadata has '0.8.21.post0')

I'm trying to update Duplicity with pip install -U duplicity, but it fails with the following output:
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: duplicity in /usr/lib/python3/dist-packages (0.8.20)
Collecting duplicity
Using cached duplicity-0.8.21.post7.tar.gz (1.4 MB)
Preparing metadata (setup.py) ... done
Discarding https://files.pythonhosted.org/packages/23/01/c8fabb7811feb13d762d976155f3dba912f0dab93f033c655f3180148574/duplicity-0.8.21.post7.tar.gz#sha256=3c526376e61a372c9a5aee8b3a52d4b498d297711d7fb232604ace87c378ba41
(from https://pypi.org/simple/duplicity/) (requires-python:>2.6, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*, <4):
Requested duplicity from https://files.pythonhosted.org/packages/23/01/c8fabb7811feb13d762d976155f3dba912f0dab93f033c655f3180148574/duplicity-0.8.21.post7.tar.gz#sha256=3c526376e61a372c9a5aee8b3a52d4b498d297711d7fb232604ace87c378ba41
has inconsistent version: filename has '0.8.21.post7', but metadata has '0.8.21.post0'
I see it uses some cached file, but I failed to find it to try to clear it. Also I see it mismatches some metadata in downloaded file, but it was released a while ago (last Nov) so unlikely anything this critical would be overseen. Still, I'm out of clue how to fix it on my end.
Googling with any parts of this message also didn't bring anything.
I see it was released quite a while ago (last Nov), so I believe it should be something on my side.
If anything, I'm under Ubuntu 21.10 and my Python is 3.9.7.
Any input is highly appreciated.
I just ran into the same problem. Resolved it using these steps:
installed the "basic requirements" from https://gitlab.com/duplicity/duplicity/-/blob/rel.0.8.21/requirements.txt via pip: python3 -m pip --no-cache-dir install fasteners future python-gettext "setuptools>=44.1.1" "setuptools-scm>=5.0.2"
tried installing duplicity: python3 -m pip --no-cache-dir install "duplicity==0.8.21.post7"
resolved missing system packages as they popped up, then retried
Worked for me after a few rounds :)

Django admin script not installed to PATH

I'm on a new computer, and have to install Django again, so I typed the pip install Django command in my VSCode terminal to install it. However, after it downloads, I get this message:
WARNING: The script django-admin.exe is installed in 'C:\Users\Xiaow\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Because of this, I can't start any new projects. How would I install this script to PATH? Is there a command I have to do or something?
There also seems to be a .vscode folder in 'C:\Users\Xiaow' but I don't know if this is what is making Django not install the admin script to PATH.
Everything else works, like I can go to my existing projects (copied over from my old computer) and runserver, and can access all the databases. However, it's just this admin script that is causing problems. I also tried uninstalling and reinstalling Django to no avail.
Full terminal message:
PS C:\Code> pip install Django
Defaulting to user installation because normal site-packages is not writeable
Collecting Django
Using cached Django-3.1.4-py3-none-any.whl (7.8 MB)
Requirement already satisfied: pytz in c:\users\xiaow\appdata\roaming\python\python39\site-packages (from Django) (2020.4)
Requirement already satisfied: sqlparse>=0.2.2 in c:\users\xiaow\appdata\roaming\python\python39\site-packages (from Django) (0.4.1)
Requirement already satisfied: asgiref<4,>=3.2.10 in c:\users\xiaow\appdata\roaming\python\python39\site-packages (from Django) (3.3.1)
Installing collected packages: Django
WARNING: The script django-admin.exe is installed in 'C:\Users\Xiaow\AppData\Roaming\Python\Python39\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed Django-3.1.4
I'm pretty sure that you need to add the path from the script to your list of environment variables... You can do so by running a command.
Try running this in the windows command prompt:
set PATH=%PATH%;C:\Users\Xiaow\AppData\Roaming\Python\Python39\Scripts
Also, here is the source of the command listed above:
Adding a directory to the PATH environment variable in Windows
UPDATE:
Just learned that the set command only sets the variable for the current session, so if you want the change to stay permanent then go ahead and use setx instead.

Python pip install cannot find module

So I am trying to install pylint using pip, as my work machine is offline I have downloaded pylint using pip and transferred this using a CD. As part of pylint download it also brought down asteroid, colorama, isort, lazy_object_proxy, McCabe, six, typed ast and wrapt.
However when running the install for pylint using the following command inside the directory with all the above files in:
python -m pip install --no-index --find-links . -r requirements.txt
This starts to work with it collecting pylint, isort and a couple of others, however after collecting asteroid it goes to collect lazy object proxy (which is in the directory) and gives the following error:
Could not find a version that satisfies the requirement lazy-object-proxy (from asteroid<3,>=2.2.0->pylint->-r requirements.txt (line 1)) (from versions: ) No matching distribution found for lazy-object-proxy (from asteroid<3,>=2.2.0->pylint->-r requirements.txt (line 1))
The version of lazy object proxy downloaded is 1.4.1
Im fairly new to this so maybe there is something in this error that highlights why it doesn't see or like the version that is downloaded and in the directory, any help would be much appreciated.
OS is windows 7, running python version 3.6.0
NOTE: even trying to just install lazy object proxy on its own fails saying it doesn't exist, its like its not there although it is in the folder.

Error while installing pip using get-pip.py with Python2.7.10

I am using Python2.7.10 on a Windows10 machine, and wish to install pip.
I followed the instructions from here to get the get-pip.py file, but when I try to run it I get the following error:
Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
I found that if I install an older version of pip (for Python2.6) then the installation is successful, and I can use pip regularly. If I try to use this older version (9.0.3) to install the newer one (18.0) then I get the same error message.
The complete log of the installation is below (1). If I manually install setuptools then I get the same message when it tries to download the next package:
Any assistance with installing the newer version will be much appreciated :-)
1)
C:\Python27\Lib\site-packages>python get-pip.py
Collecting pip
Using cached https://files.pythonhosted.org/packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/ff/f4/385715ccc461885f3cedf57a41ae3c12b5fec3f35cce4c8706b1a112a133/setuptools-40.0.0-py2.py3-none-any.whl (567kB)
1% |Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
Update: after installing several packages manually I was able to install the new pip version. It obviously didn't solve the problem, and pip is still not working. When trying to use it, the same error message appears at every attempted download. See log at (2). I double checked the address, and it appears to be correct.
2)
Collecting Requests
Downloading https://files.pythonhosted.org/packages/65/47/7e02164a2a3db50ed6d8a6ab1d6d60b69c4c3fdf57a284257925dfc12bda/requests-2.19.1-py2.py3-none-any.whl (91kB)
11% |Could not install packages due to an EnvironmentError: [Errno 42] Illegal byte sequence
Thanks
tl;qr - add the quiet flag (-q) to your command
While trying to debug I redirected the output to a file:
python -m pip install requests > .\temp.txt
Surprisingly, everything suddenly worked!
It appears there is a known bug (Thanks Matan M) while displaying the progress bar to the console. Basically, any solution that would avoid writing it would work.
Here are some options:
Use the -q flag
Turn off the progress bar using --progress-bar off
Redirect to a temp file
:-)
Hi check if you added the relevant python paths to the PATH.
pip install <package> -q **or**
--progress-bar off

Heroku fails to install dependency - How do I fix it?

I'm trying to push an app to Heroku (first time) and it continues to fail when attempting to install on of the dependencies in the requirements.txt file.
The dependency is for the etsy-python library ("pip install etsy" fails).
Locally, I was able to get this to work by downloading and building the source. How can I get past this issue with Heroku?
requirements.txt:
Flask==0.9
Jinja2==2.6
Werkzeug==0.8.3
etsy==0.3.1
geopy==0.94.2
httplib2==0.7.7
oauth2==1.5.211
python-etsy==0.1.2
python-twitter==0.8.4
requests==1.0.4
requests-oauth==0.4.1
simplejson==3.0.4
I was able to fix this by modifying the requirements.txt as follows:
Although the pypi package for Etsy is not working, the source is ok and builds without problems.
Flask==0.9
Jinja2==2.6
Werkzeug==0.8.3
-e git+https://github.com/mcfunley/etsy-python.git#egg=etsy-python
geopy==0.94.2
httplib2==0.7.7
oauth2==1.5.211
python-etsy==0.1.2
-e git+https://github.com/bear/python-twitter.git#egg=python-twitter
requests==1.0.4
requests-oauth==0.4.1
simplejson==3.0.4
I'm getting this error when I try to install etsy locally:
ValueError: Invalid IPv6 URL
I'd say that the official py-etsy is outdated and broken, the Github repo was last updated a year ago: https://github.com/mcfunley/etsy-python. This library is more recent (5 months ago): https://github.com/priestc/python-etsy.
It's not on pypi, but clone it locally and include it in your project.

Categories