Tag Archives: pip

[Solved] ERROR: Could not open requirements file: [Errno 2] No such file or directory : ‘requirments.txt‘

After checking the relevant information, I found out that this is actually a path setting problem. It is that your text actually exists, but the path you set is not correct causing the system to not find the requriements.txt file.

So, you just need to change your path setting to the path of the parent file you want to query.

I use the cmd system command cd to enter the specified file and then pip install -r requirments.txt method.

Example.

If requirements.txt is under the PythonProject file, then use

Cd C:\Users\xizhou\Desktop\PythonProject # Enter superior files first

pip install -r requirements.txt # Install pip again

The file can then be found.

[Solved] Fatal Python error: initfsencoding: Unable to get the locale encoding

Error Message:

Fatal Python error: initfsencoding: Unable to get the locale encoding

ModuleNotFoundError: No module named 'encodings'

 

Solution:

#1.unset
unset PYTHONHOME
unset PYTHONPATH
#2.update pip
python -m pip install --upgrade pip

Then it can be solved.

pip install decord failed. The reason is that pip has a problem. After the update, it is installed normally

VScode: How to Solve Pylance Error (pip Library Files Installed)

View Python installation location

Enter in Terminal

where python

View PIP installation library file location

pip show <packagename>

Open vscode and set the library path

Ctrl+shift+p Open ` preference; Open Settings(JSON)

Add path

"python.analysis.extraPaths":[
	    "/root/miniconda3/lib/python3.9/site-packages",
        "/root/.local/lib/python3.9/site-packages",
        "...."
        ]

[Solved] pycallgraph Install Error: subprocess-exited-with-error

In the win7 system, under the command terminal, the two methods of installing pycallgraph report the exception of subprocess exited with error


Solution: downgrade setuptools

1. First check the current version of setuptools.

pip show setuptools

2. The version of setuptools has been downgraded. Here, I downgraded it to 57.5.0

pip install --upgrade setuptools==57.5.0

3. Try installing pycallgraph again

pip install pycallgraph

[Solved] ERROR: Failed building wheel for pycryptodome

Error: failed building wheel for pycryptodome PIP installation error solution

1. Questions

PIP install pycryptodome build wheel error error error stack display reference OpenSSL error

 ERROR: Failed building wheel for pycryptodome

2. Solutions

# ①. install brew
# ②. install openssl@1
# ③ link to openssl
env LDFLAGS="-L$(brew --prefix openssl)/lib" CFLAGS="-I$(brew --prefix openssl)/include"

3. Other collected information

For devices using apple silicon, you can try this (because the default homebrew bin directory is different)

export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include"

You can enter the view command yourself

brew info openssl

If you want to install an older version of cryptography (such as 2.9.x), you must link [email protected] instead of openssl@3

brew install openssl will prompt you to export

 

[Solved] error in REfO setup command: use_2to3 is invalid.

Problem Description: When using pip command to install refo==0.13 version, it will show that it is installed as 0.12 version because 0.13 version only has .tar.gz file and no whl file, pip installation will select 0.12 version, while manually downloading 0.13 version .tar.gz file and installing offline, it will report an error, the following is the process of the problem.

Requirement: install refo==0.13 version

pip install refo
#It will automatically install 0.12, because 0.13 does not have xhl files

pip install refo==0.13
#Error in REfO setup command: use_2to3 is invalid.
error in REfO setup command: use_2to3 is invalid.

# Download the 0.13 .tar.gz file and install it offline with the same error.
error in REfO setup command: use_2to3 is invalid.

Check the data and the problem is:

setuptools>= 58 interrupt support use_2to3

Setuptools change log for V58

setuptools should be updated to setuptools<Version 58 or avoid using use_2to3 set the package in the parameters.

Solution: Execute the following command:

pip install setuptools==56.0.0
#After execution, setuptools will automatically fall back to version 56.0.0

Then just install the refo==0.13 version.tar.gz file offline

Supplement the contents of the third-party package for offline installation:

Python third-party library download website Python third-party library

.whl file installation.

Go to the directory of the above whl file from the command line interface in one of the environments under anaconda where the library needs to be installed
Install the library using the command: pip install xxxxx.whl
.tar.gz file installation.

From the command line interface, go to the above extracted directory in the environment where the library is to be installed under anaconda
Use the command: python setup.py install

[Solved] No module named ‘pywt‘ or ModuleNotFoundError: No module named ‘skimage.metrics‘

Solution:

pip install pywavelets
or
pip install scikit-image
The relevant dependencies pywavelets will be installed automatically

If an error is reported later:
modulenotfounderror: no module named ‘skimage metrics‘

If the skimage version is too low, update to the latest version (or 0.18+):

pip install scikit-image --upgrade

[Solved] ERROR: pip‘s dependency resolver does not currently take into account all the packages that are inst

When installing wrapt, the following error is reported:

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
tensorflow 2.7.0 requires h5py>=2.9.0, which is not installed.
tensorflow 2.7.0 requires typing-extensions>=3.6.6, which is not installed.
tensorflow 2.7.0 requires wheel<1.0,>=0.32.0, which is not installed.

Just follow the prompts

pip install h5py
pip install typing-extensions
pip install wheel

[Solved] Python import Error: pip –upgrade Error: ERROR: Cannot uninstall ‘dnspython‘. It is a distutils installed

Background:
today we use package to install the module dnspython

[root@makel ~] wget http://www.dnspython.org/kits/1.9.4/dnspython-1.9.4.tar.gz
[root@makel ~] tar -xvf dnspython-1.9.4.tar.gz
[root@makel ~] cd dnspython-1.9.4/
[root@makel dnspython-1.9.4] python3 setup.py install

Solution process
1. Enter Python and import reports an error (problem found)

[root@makel ~] python3
Python 3.8.5 (default, Nov  7 2021, 21:47:38) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dns.resolver
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/python3/lib/python3.8/site-packages/dns/resolver.py", line 26, in <module>
    import dns.message
  File "/usr/local/python3/lib/python3.8/site-packages/dns/message.py", line 175
    return '<DNS message, ID ' + `self.id` + '>'
                                 ^
SyntaxError: invalid syntax

2. Try upgrading (– upgrade) and find that it still can’t be installed

[root@makel ~] pip3 install dnspython --upgrade
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Requirement already satisfied: dnspython in /usr/local/python3/lib/python3.8/site-packages (1.9.4)
Collecting dnspython
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/f5/2d/ae9e172b4e5e72fa4b3cfc2517f38b602cc9ba31355f9669c502b4e9c458/dnspython-2.1.0-py3-none-any.whl (241 kB)
     |████████████████████████████████| 241 kB 898 kB/s            
Installing collected packages: dnspython
  Attempting uninstall: dnspython
    Found existing installation: dnspython 1.9.4
ERROR: Cannot uninstall 'dnspython'. 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.

3. A new error occurred while attempting to uninstall

[root@makel ~] pip3 uninstall dnspython
Found existing installation: dnspython 1.9.4
ERROR: Cannot uninstall 'dnspython'. 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.

4. If the command cannot be unloaded, delete the file manually

[root@makel ~] cd /usr/local/python3  #Go to the directory where python is installed
[root@makel python3] find ./-name "*package*" #Fuzzy search package
./lib/python3.8/site-packages
./lib/python3.8/site-packages/setuptools/package_index.py
./lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.pyc
./lib/python3.8/site-packages/setuptools/__pycache__/package_index.cpython-38.opt-1.pyc
......
[root@makel python3] cd lib/python3.8/site-packages/ #Find site-packages from the above results and go to this directory
[root@makel site-packages] ll  
total 96
drwxr-xr-x. 4 root root  4096 Nov 16 17:18 dns
-rw-r--r--. 1 root root  1277 Nov  9 22:31 dnspython-1.9.4-py3.8.egg-info
....
[root@makel site-packages] rm -rf dnspython-1.9.4-py3.8.egg-info   #Delete all files containing the module name

5. Reinstall and import successfully after installation

[root@makel site-packages] pip3 install dnspython #reinstall
[root@makel site-packages] python3
Python 3.8.5 (default, Nov  7 2021, 21:47:38) 
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dns.resolver
>>> exit

[Solved] Import gensim Error: RuntimeError: Cython extensions are unavailable.

Gensim was installed successfully, but a runtimeerror occurred during import
the runtime error is as follows:
runtimeerror: Python extensions are unavailable. Without them, this gensim functionality is disabled. If you’ve installed from a package, ask the package maintainer to include Python extensions. If you’re building gensim from source yourself, run python setup. py build_ Ext — inplace and retry.
after reading other users’ articles, it is found that numpy and SciPy are incompatible with gensim

The solution steps are as follows

    1. view the python adaptation information, download the adapted numpy and SciPy WHL files, install the WHL files, download the gensim again, and run successfully.

First, check the version information of your Python adaptation before downloading the file
Open CMD and directly enter PIP debug -- verbose on the command line. The results are as follows

after finding it, go to the following link to download the adapted numpy and SciPy files

https://www.lfd.uci.edu/ ~gohlke/pythonlibs/

The corresponding downloaded file on my computer is

After downloading, enter CMD
CD to download SciPy and numpy + MKL
Python – M PIP install scipy-1.7.2-cp37-cp37m-win_ amd64.whl
python -m pip install numpy-1.21.4+mkl-cp37-cp37m-win_ amd64.whl

Then uninstall gensim and install gensim
finally, you can import