Tag Archives: pip

fatal error: Python.h: No such file or directory

fatal error: Python.h: No such file or directory

Process: through PIP install a library, an error occurred and the python. H header file could not be found

Solution

Search stackoverflow. My environment is CentOS, so execute sudo Yum install python3 devel and then go to the PIP install library. It’s all OK

For apt (Ubuntu, Debian…):

sudo apt-get install python-dev   # for python2.x installs
sudo apt-get install python3-dev  # for python3.x installs

For yum (CentOS, RHEL…):

sudo yum install python-devel    # for python2.x installs
sudo yum install python3-devel   # for python3.x installs

For dnf (Fedora…):

sudo dnf install python2-devel  # for python2.x installs
sudo dnf install python3-devel  # for python3.x installs

For zippers (openSUSE):

sudo zypper in python-devel   # for python2.x installs
sudo zypper in python3-devel  # for python3.x installs

For apk (Alpine…):
This is a departure from the normal Alpine naming
scheme, which uses py2- and py3- prefixes

sudo apk add python2-dev  # for python2.x installs
sudo apk add python3-dev  # for python3.x installs

For apt-cyg (Cygwin…):

apt-cyg install python-devel   # for python2.x installs
apt-cyg install python3-devel  # for python3.x installs

Importerror: no module named typing error reporting solution (python2 PIP needs to be backed back from 21)

The default installation of PIP for python2 is version 21. This version is no longer supported, so an error is reported when executing pip. You need to back up the PIP version and execute the following command

curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
python -m pip install --upgrade "pip < 21.0"

Mac Upgrade pip WARNING: You are using pip version 21.1.1; however, version 21.1.3 is available. You s

error:
WARNING: You are using pip version 21.1.1; however, version 21.1.3 is available.
You should consider upgrading via the ‘/usr/local/opt/[email protected]/bin/python3.9 -m pip install –upgrade pip’ command.
Error solution
I also used the Windows upgrade method and found that it didn’t work, what a fucking headache!
Windows pip upgrade link

The right solution
pip3 install –upgrade pip

ClobberError: The package ‘xxx‘ cannot be installed due to a path collision for ‘xx‘ This path alre

Original link: https://stackoverflow.com/questions/51217876/conda-update-anaconda-fails-clobbererror?newreg=2c51dd84b04b42c49294714471612f07

The reason for this problem is that the versions of related packages such as CONDA and pip are too low to be updated automatically. Solution: enter the following command on the command line:

conda clean --all
conda update --all

ModuleNotFoundError: No module named ‘ahocorasick‘ [100% Work Method]

ModuleNotFoundError: No module named ‘ahocorasick‘,
Install:

pip install pyahocorasick -i HTTPS://mirrors.aliyun.com/pypi/simple/

The following are the errors I encountered during installation:
error: Microsoft Visual C + + 14.0 is required. Get it with "Microsoft Visual C + + build tools,
Microsoft Visual C + + 14.0 needs to be installed

Recently, I was engaged in the knowledge mapping of natural language processing
but when building the system, I used a AC automaton word filtering , which is to remove sensitive words, such as

these sensitive words, which need to be replaced by some implied words or symbols such as * *. There are many ways to do this

- 1, AC automata
- 2, DFA filtering algorithm
- 3, replace filtering
- 4, regular expression filtering
for AC automata filtering, you need to use ahocorasick this library, now pyahocorasick

pip install pyahocorasick -i HTTPS://mirrors.aliyun.com/pypi/simple/

However, when installing pyahocorasick, it reported an error
that we need to install it

This is recommended to you error: Microsoft Visual C + + 14.0 is required. Get it with “Microsoft Visual C + + build tools, pro test 100% installation
it is offline installation, there will be no damage to the installation package;

The following is my successful installation of pyahocorasick:

Python 2.7: How to Install PIP

Python2 is no longer supported after PIP 2.1. Here you can use scripts to automatically download the highest supported version of PIP

1. Python2.7 the latest version of PIP installation file get-pip.py can be obtained by streaming

2. Install the file through Python 2.7

In the scripts folder, execute the following command to pull the get-pip.py file

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip.py

After downloading, execute the file to install the latest version of PIP supported by python2.7

python get-pip.py

You can see that the PIP version of automatic installation is 20.3

.4

[Solved] ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

Solution

https://cryptography.io/en/latest/installation/

$ apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo
$ pip install --upgrade pip
$ export CRYPTOGRAPHY_DONT_BUILD_RUST=1
$ pip install cryptography

Solution process

      =============================DEBUG ASSISTANCE=============================
      If you are seeing a compilation error please try the following steps to
      successfully install cryptography:
      1) Upgrade to the latest pip and try again. This will fix errors for most
         users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
      2) Read https://cryptography.io/en/latest/installation.html for specific
         instructions for your platform.
      3) Check our frequently asked questions for more information:
         https://cryptography.io/en/latest/faq.html
      4) Ensure you have a recent Rust toolchain installed:
         https://cryptography.io/en/latest/installation.html#rust
      5) If you are experiencing issues with Rust for *this release only* you may
         set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
      =============================DEBUG ASSISTANCE=============================

  error: can't find Rust compiler

  If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

  To update pip, run:

      pip install --upgrade pip

  and then retry package installation.

  If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.

  This package requires Rust >=1.41.0.
  ----------------------------------------
  ERROR: Failed building wheel for cryptography
Failed to build cryptography
ERROR: Could not build wheels for cryptography which use PEP 517 and cannot be installed directly

It is found that the solution is given above

      =============================DEBUG ASSISTANCE=============================
      If you are seeing a compilation error please try the following steps to
      successfully install cryptography:
      1) Upgrade to the latest pip and try again. This will fix errors for most
         users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
      2) Read https://cryptography.io/en/latest/installation.html for specific
         instructions for your platform.
      3) Check our frequently asked questions for more information:
         https://cryptography.io/en/latest/faq.html
      4) Ensure you have a recent Rust toolchain installed:
         https://cryptography.io/en/latest/installation.html#rust
      5) If you are experiencing issues with Rust for *this release only* you may
         set the environment variable `CRYPTOGRAPHY_DONT_BUILD_RUST=1`.
      =============================DEBUG ASSISTANCE=============================

============================= Debugging assistance =============================
If you see a compilation error, try the following steps
Install encryption successfully:
1) Upgrade to the latest pip and try again. This will fix most errors
users. See:https://pip.pypa.io/en/stable/installing/ upgrading-pip
2) Read specifically https://cryptography.io/en/latest/installation.html
for your platform instructions.
3) Check out our FAQ for more information:
https://cryptography.io/en/latest/faq.html
4) Make sure you have recently installed the Rust toolchain:
https://cryptography.io/en/latest/installation.html#rust
5)If you are experiencing problems with Rust in *this version*, you can
set the environment variable ' CRYPTOGRAPHY_DONT_BUILD_RUST=1 '.
============================= Debugging assistance =============================

First, upgrade pip

pip install --upgrade pip

After I upgrade, I will install again or report an error (some people on the Internet have solved it, if you have solved it, ignore the following contents)

Continue to look at the above content and say that my rust version is too low
to view the official website, you need to install the relevant dependencies

https://cryptography.io/en/latest/installation/

sudo apk add gcc musl-dev python3-dev libffi-dev openssl-dev cargo

Re install or report an error, continue to follow the instructions to continue processing

     ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-km3x31je/matplotlib_fcb1836ff32b459797e98afb66f6211e/setup.py'"'"'; __file__='"'"'/tmp/pip-install-km3x31je/matplotlib_fcb1836ff32b459797e98afb66f6211e/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-7833r8p7
         cwd: /tmp/pip-install-km3x31je/matplotlib_fcb1836ff32b459797e98afb66f6211e/
    Complete output (44 lines):
    WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
    ERROR: Could not find a version that satisfies the requirement numpy>=1.16 (from versions: none)
    ERROR: No matching distribution found for numpy>=1.16
    Traceback (most recent call last):
      File "/usr/local/lib/python3.7/site-packages/setuptools/installer.py", line 75, in fetch_build_egg
        subprocess.check_call(cmd)
      File "/usr/local/lib/python3.7/subprocess.py", line 363, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpd6d05k3_', '--quiet', 'numpy>=1.16']' 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 "/tmp/pip-install-km3x31je/matplotlib_fcb1836ff32b459797e98afb66f6211e/setup.py", line 314, in <module>
        cmdclass=cmdclass,
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 152, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python3.7/site-packages/setuptools/__init__.py", line 147, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 782, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 768, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1051, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1063, in obtain
        return installer(requirement)
      File "/usr/local/lib/python3.7/site-packages/setuptools/dist.py", line 838, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/usr/local/lib/python3.7/site-packages/setuptools/installer.py", line 77, in fetch_build_egg
        raise DistutilsError(str(e)) from e
    distutils.errors.DistutilsError: Command '['/usr/local/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpd6d05k3_', '--quiet', 'numpy>=1.16']' returned non-zero exit status 1.

    Edit setup.cfg to change the build options; suppress output with --quiet.

    BUILDING MATPLOTLIB
      matplotlib: yes [3.4.2]
          python: yes [3.7.10 (default, Jun 29 2021, 01:54:47)  [GCC 10.3.1
                      20210424]]
        platform: yes [linux]
           tests: no  [skipping due to configuration]
          macosx: no  [Mac OS-X only]

Setting environment variables

export CRYPTOGRAPHY_DONT_BUILD_RUST=1
pip install cryptography

It was a success this time.

[Solved] Ubuntu18.04 Install pyqt5 error: Command “python setup.py egg_info“ failed with error code 1 in /tmp/pip-build-92

Error in installing pyqt5 on Ubuntu 18.04:
command “Python setup.py egg”_ info” failed with error code 1 in /tmp/pip-build-92ggdywh/PyQt5/

As a result, the version of PIP is too low. The default system version is pip9, so we need to update the PIP version
the update method is as follows:

python3 -m pip install --upgrade pip

Because most of the time, we install python, or apt install Python directly, resulting in the installation of python2.7. If you just want to use a version of python, such as python3, you can uninstall python2. It’s better to uninstall to avoid conflicts.

How to Solve Python WARNING: Ignoring invalid distribution -ip (e:\python\python_dowmload\lib\site-packages)

Recently, when using pip to install the plug-in, the following warning message appears:

WARNING: Ignoring invalid distribution -ip (e:\python\python_ dowmload\lib\site-packages)

resolvent:

Find the directory where the error is reported in the warning message, and then delete the folder at the beginning of ~. That kind of thing is caused by the plug-in installation failure/Midway exit, which leads to the plug-in installation exception. Although the warning message does not affect, it has obsessive-compulsive disorder. Just delete the folder:

As for why the above problems appear?

Because a few days ago, when I was using Python 3.9 to build the robot framework environment, I needed to install wxPython, and then when the latest fashion was installed, later when the robot framework ride was installed,

One of the components it depends on does not support the latest version, and the component it depends on does not support Python 3.9, so there was an exception when installing the plug-in.

[How to Solve] ImportError: No module named typing

python version 2.7
Error
This error occurs when using pip

Traceback (most recent call last):
File “C:\Python27\Scripts\pip-script.py”, line 9, in
load_entry_point(‘pip==21.1.3’, ‘console_scripts’, ‘pip’)()
File “C:\Python27\lib\site-packages\pkg_resources_init_.py”, line 542, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “C:\Python27\lib\site-packages\pkg_resources_init_.py”, line 2569, in load_entry_point
return ep.load()
File “C:\Python27\lib\site-packages\pkg_resources_init_.py”, line 2229, in load
return self.resolve()
File “C:\Python27\lib\site-packages\pkg_resources_init_.py”, line 2235, in resolve
module = import(self.module_name, fromlist=[‘name’], level=0)
File “C:\Python27\lib\site-packages\pip_init_.py”, line 1, in
from typing import List, Optional
ImportError: No module named typing

The solution is to update python to 3, but I want to use 2.7, so this method does not work
Solution
I found that the version of pip is too high, and it is not compatible with python2, my version is pip21.1.3, so I need to set back the version of pip, the solution is as follows, just run it in order

curl -O https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
python -m pip install --upgrade "pip < 21.0"

Perfect solution, PIP version back, install again without error correction

AttributeError: module ‘keras.backend‘ has no attribute ‘eager‘

Project scenario:

under Windows environment, python 3.6, the versions of each CONDA package are as follows 0

\# Name                    Version                   Build  Channel
absl-py                   0.13.0                    <pip>
astor                     0.8.1                     <pip>
cached-property           1.5.2                     <pip>
certifi                   2021.5.30        py36ha15d459_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
cycler                    0.10.0                    <pip>
dataclasses               0.8                       <pip>
gast                      0.2.2                     <pip>
google-pasta              0.2.0                     <pip>
grpcio                    1.38.1                    <pip>
h5py                      3.1.0                     <pip>
importlib-metadata        4.6.0                     <pip>
joblib                    1.0.1                     <pip>
Keras                     2.3.1                     <pip>
Keras-Applications        1.0.8                     <pip>
Keras-Preprocessing       1.1.2                     <pip>
kiwisolver                1.3.1                     <pip>
Markdown                  3.3.4                     <pip>
matplotlib                3.3.4                     <pip>
numpy                     1.19.5                    <pip>
opt-einsum                3.3.0                     <pip>
pandas                    1.1.5                     <pip>
Pillow                    8.2.0                     <pip>
pip                       21.1.3             pyhd8ed1ab_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
protobuf                  3.17.3                    <pip>
pyparsing                 2.4.7                     <pip>
python                    3.6.13          h39d44d4_0_cpython    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
python-dateutil           2.8.1                     <pip>
python_abi                3.6                     2_cp36m    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
pytz                      2021.1                    <pip>
PyYAML                    5.4.1                     <pip>
scikit-learn              0.24.2                    <pip>
scipy                     1.5.4                     <pip>
seaborn                   0.11.1                    <pip>
setuptools                49.6.0           py36ha15d459_3    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
six                       1.16.0                    <pip>
sklearn                   0.0                       <pip>
tensorboard               1.15.0                    <pip>
tensorflow                1.15.0                    <pip>
tensorflow-estimator      1.15.1                    <pip>
termcolor                 1.1.0                     <pip>
threadpoolctl             2.1.0                     <pip>
typing-extensions         3.10.0.0                  <pip>
ucrt                      10.0.20348.0         h57928b3_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
vc                        14.2                 hb210afc_5    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
vs2015_runtime            14.29.30037          h902a5da_5    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
Werkzeug                  2.0.1                     <pip>
wheel                     0.36.2             pyhd3deb0d_0    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
wincertstore              0.2             py36ha15d459_1006    https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
wrapt                     1.12.1                    <pip>
zipp                      3.4.1                     <pip>

Problem Description:

it seems that the version of the library that has been adjusted for a long time has finally run through a LSTM demo, but if you want to open a new test file for testing, the following problems appear


Solution:

the solution to stackoverflow is to use the current keras library and tensorflow Library of unitall, because the higher version of keras library may be used, but the running code is of lower version. Note that you need to install tensorflow before installing keras

The specific steps of stackoverflow with the most likes are as follows:
delete tenorflow delete tenorflow

pip uninstall tensorflow

Update PIP version

pip install --upgrade pip

install keras

pip install Keras

install tensorflow

pip install tensorflow

Apart from this method, I want to say that my final solution is: I found the import statement of the keras library

from keras.models import Sequential
from keras.layers import LSTM, Dense, Activation

Cannot appear in two. Py files!!! Even if you just don’t use import, you will still report this error. It’s too bad. I found this problem after reloading it, so when testing the code, you should either create a new project or write the import statement in a file.