#
ERROR: Command errored out with exit status 1: python setup.py egg_info
To solve the "ERROR: Command errored out with exit status 1: python setup.py
egg_info":
-
Upgrade your versions of
pip
,
setuptools
and
wheel
before running
pip install
.
-
On Windows, download and install the package from unofficial binaries.
-
Try to install the package with the
--pre
option.
-
Check if your Python version is supported by the package.
ERROR: Command errored out with exit status 1:
File "c:\users\bobbyhadz\appdata\local\programs\python\python310\lib\site-packages\setuptools\msvc.py", line 371, in _find_latest_available_vc_ver
raise distutils.errors.DistutilsPlatformError(err)
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
#
Upgrade your version of
pip
The first thing you should do is try to upgrade your versions of
pip
,
setuptools
and
wheel
before installing
the module.
Here are the commands for upgrading
pip
on all operating systems.
Which command works depends on your operating system and your version of Python.
pip install --upgrade pip
pip3 install --upgrade pip
python -m pip install --upgrade pip
python3 -m pip install --upgrade pip
py -m pip install --upgrade pip
easy_install --upgrade pip
sudo easy_install --upgrade pip
pip install --upgrade pip --user
python -m pip install --user --upgrade pip
python3 -m pip install --user --upgrade pip
curl https://bootstrap.pypa.io/get-pip.py | python
curl https://bootstrap.pypa.io/get-pip.py | sudo python
sudo apt-get update && apt-get upgrade python-pip
sudo yum install epel-release
sudo yum install python-pip
sudo yum update python-pip
Now that your version of
pip
is updated, update the
setuptools
and
wheel
packages as well.
pip install --upgrade setuptools wheel
pip3 install --upgrade setuptools wheel
python -m pip install --upgrade setuptools wheel
python3 -m pip install --upgrade setuptools wheel
py -m pip install --upgrade setuptools wheel
Try to run the
pip install
command after updating
setuptools
and
wheel
.
pip install numpy
pip3 install numpy
python -m pip install numpy
python3 -m pip install numpy
py -m pip install numpy
Make sure to replace
numpy
with the name of the module you're trying to
install.
#
Run the
pip install
command with the
--upgrade
flag
If the error is not resolved, try to run the
pip install
command with the
--upgrade
option to install the latest version of the module.
pip install numpy --upgrade
pip3 install numpy --upgrade
python -m pip install numpy --upgrade
python3 -m pip install numpy --upgrade
The
--upgrade
option upgrades the
specified package to the newest available version.
If the command works, make sure to update your
requirements.txt
file if
you have one.
pip freeze > requirements.txt
#
Disable the cache when running the command
You can also try to disable the cache with the
--no-cache-dir
option.
pip install numpy --no-cache-dir
pip3 install numpy --no-cache-dir
python -m pip install numpy --no-cache-dir
python3 -m pip install numpy --no-cache-dir
If the error persists, use the
--pre
option to include pre-release and
development versions of the package.
pip install numpy --pre
pip3 install numpy --pre
python -m pip install numpy --pre
python3 -m pip install numpy --pre
The
--pre
option makes it so
pip
includes pre-release and development
versions of the package. By default
pip
only finds stable versions.
This sometimes helps because a pre-release version of the package might have a
wheel
available for your version of Python.
If the command works, make sure to update your
requirements.txt
file if you
have one.
pip freeze > requirements.txt
If the error is not resolved, try running the
pip install
command with the
--no-use-pep517
option.
pip install --no-use-pep517 numpy
pip3 install --no-use-pep517 numpy
python -m pip install --no-use-pep517 numpy
python3 -m pip install --no-use-pep517 numpy
If you are on Windows, download a suitable
.whl
file for the package and
install it.
If you aren't on Windows, scroll past the next subheading.
#
Download and install a
.whl
file if you are on Windows
If you are on Windows, you can also download a suitable
.whl
file from the
https://www.lfd.uci.edu/~gohlke/pythonlibs/
website.
First, get your Python version and
check if your Python installation is 64-bit or 32-bit
.
You can do that by opening CMD and typing
python
.
For example, the screenshot shows that my Python version is 3.10 and my Python interpreter is 64-bit.
Now, click on the
https://www.lfd.uci.edu/~gohlke/pythonlibs/
link, press
CTRL + f
and search for the name of the package.
Download the corresponding
.whl
file. For example, if I were trying to install
the
gensim
package, I would download the following file.
gensim‑4.2.0‑cp310‑cp310‑win_amd64.whl
The
cp310
part is the version (Python 3.10) and
amd64
means 64-bit.
Once you open the file, open your shell in the directory where the file is
located (e.g.
C:\Users\Example\Downloads
) and install it using
pip
:
-
Open the directory that contains the file in Explorer.
-
Press
Shift
and right-click in Explorer.
-
Click on
"Open PowerShell window here"
.
-
Run the following command.
pip install gensim‑4.2.0‑cp310‑cp310‑win_amd64.whl
pip3 install gensim‑4.2.0‑cp310‑cp310‑win_amd64.whl
Make sure to specify the name of the
.whl
file correctly as your Python version and the name of the package will likely be different.
If that didn't help and your error message contains something like:
"error:
Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++
Build Tools":
https://visualstudio.microsoft.com/visual-cpp-build-tools/
"
,
download
Microsoft Build tools
and check the "Desktop development with C++ checkbox when installing.
#
Check if your Python version is supported by the package
The error is sometimes caused when the package you are trying to install doesn't
have available
wheels
for your version of Python.
You can check your Python version with the
python --version
command.
You can check if a package has wheels available for a specific Python version in
the
Download files
section of the
package's pypi page.
For example,
cp310
in the name of a file under "Built Distributions" means Python version 3.10 is supported for the specific operating system.
If the
.whl
files are not available for your version of Python, you can
download an older version.
You can download a specific Python version that is supported by the package if
the package doesn't support the latest Python version.
Different versions are available in the
"Looking for a specific release" table
.
Make sure to tick the following options if you get prompted:
-
Install launcher for all users (recommended)
-
Add Python to PATH (this adds Python to your PATH environment variable)
#
Create a virtual environment
To solve the error:
-
Create a virtual environment.
-
Activate the virtual environment.
-
Run the
pip install
command with the virtual environment active.
python -m venv venv
source venv/bin/activate
venv\Scripts\activate.bat
venv\Scripts\Activate.ps1
pip install tensorflow
If the
python -m venv venv
command doesn't work, try the following 2 commands:
-
python3 -m venv venv
-
py -m venv venv
Make sure to use the correct command to activate your virtual environment depending on your operating system and your shell.
Your virtual environment will use the version of Python that was used to create
it.
#
Try running pip install in verbose mode
If none of the suggestions helped, try running the
pip install
command in
verbose mode.
pip install tensorflow -vvv