How can I install fastapi properly? - python

I want to install fastapi using pip in VsCode using
pip install fastapi[all]
but I am getting this huge error. What am I doing wrong?
ERROR: Command errored out with exit status 1:
command: 'C:\Users\krish\Desktop\Codes\API\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\krish\\AppData\\Local\\Temp\\pip-install-eqmneh6a\\httptools_b8491d7c29264d1c9eb72c9367d56d7a\\setup.py'"'"'; __file__='"'"'C:\\Users\\krish\\AppData\\Local\\Temp\\pip-install-eqmneh6a\\httptools_b8491d7c29264d1c9eb72c9367d56d7a\\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'"'"'))' install --record 'C:\Users\krish\AppData\Local\Temp\pip-record-wvba_iw2\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\krish\Desktop\Codes\API\venv\include\site\python3.10\httptools'
cwd: C:\Users\krish\AppData\Local\Temp\pip-install-eqmneh6a\httptools_b8491d7c29264d1c9eb72c9367d56d7a\
Complete output (25 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.10
creating build\lib.win-amd64-3.10\httptools
copying httptools\_version.py -> build\lib.win-amd64-3.10\httptools
copying httptools\__init__.py -> build\lib.win-amd64-3.10\httptools
creating build\lib.win-amd64-3.10\httptools\parser
copying httptools\parser\errors.py -> build\lib.win-amd64-3.10\httptools\parser
copying httptools\parser\__init__.py -> build\lib.win-amd64-3.10\httptools\parser
running egg_info
writing httptools.egg-info\PKG-INFO
writing dependency_links to httptools.egg-info\dependency_links.txt
writing requirements to httptools.egg-info\requires.txt
writing top-level names to httptools.egg-info\top_level.txt
reading manifest file 'httptools.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
adding license file 'LICENSE'
writing manifest file 'httptools.egg-info\SOURCES.txt'
copying httptools\parser\parser.c -> build\lib.win-amd64-3.10\httptools\parser
copying httptools\parser\url_parser.c -> build\lib.win-amd64-3.10\httptools\parser
running build_ext
building 'httptools.parser.parser' extension
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/
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\krish\Desktop\Codes\API\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\krish\\AppData\\Local\\Temp\\pip-install-eqmneh6a\\httptools_b8491d7c29264d1c9eb72c9367d56d7a\\setup.py'"'"'; __file__='"'"'C:\\Users\\krish\\AppData\\Local\\Temp\\pip-install-eqmneh6a\\httptools_b8491d7c29264d1c9eb72c9367d56d7a\\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'"'"'))' install --record 'C:\Users\krish\AppData\Local\Temp\pip-record-wvba_iw2\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\krish\Desktop\Codes\API\venv\include\site\python3.10\httptools' Check the logs for full command output.

The solution from this post worked:
pip install --only-binary :all: fastapi[all]

u install 'uvicorn' differently?
Try to do these commands :
pip install "uvicorn[standard]"
The library needs the VC v14+ runtime library, not VS build tools. You can get the runtime from the MS downloads page. Install the VS 2015/2017/2019 redist as it is the latest version.

Installing fastapi[all] FROM VS Code
From a Notebook Code Cell in VS Code
You might have only been missing the exclamation mark and/or the quotes ...
!pip install "fastapi[all]"
From a Terminal Shown Within VS Code
$ pip install "fastapi[all]"
Both worked for me from VS Code installed on Linux Mint 20.3
The same principles apply for uvicorn[standard] when you install that.

You can install poetry, which is a new python dependency management tool (equivalent to yarn / npm for Node.js and bundler for ruby) that makes it easier to manage dependencies in your project and beats pip by a mile. It is also very easy to install.
# install command pip install poetry
# Verify the installed version poetry --version
poetry add fastapi uvicorn[standard]
# zsh USE: poetry add fastapi "uvicorn[standard]"
enter image description here
When poetry installs the dependencies, they are documented in the pyproject.toml file.

Related

why i cant pip install autopy?

Collecting autopy
Using cached autopy-4.0.0.tar.gz (20 kB)
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for autopy, since package 'wheel' is not installed.
Installing collected packages: autopy
Running setup.py install for autopy ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nitro 5\\AppData\\Local\\Temp\\pip-install-a48eed40\\autopy_364831de627945c491e2f14d454eac9f\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nitro 5\\AppData\\Local\\Temp\\pip-install-a48eed40\\autopy_364831de627945c491e2f14d454eac9f\\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'"'"'))' install --record 'C:\Users\Nitro 5\AppData\Local\Temp\pip-record-6f8m7fge\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python39\Include\autopy'
cwd: C:\Users\Nitro 5\AppData\Local\Temp\pip-install-a48eed40\autopy_364831de627945c491e2f14d454eac9f\
Complete output (22 lines):
running install
c:\python39\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\autopy
copying autopy\__init__.py -> build\lib.win-amd64-3.9\autopy
running build_ext
running build_rust
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.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\Nitro 5\\AppData\\Local\\Temp\\pip-install-a48eed40\\autopy_364831de627945c491e2f14d454eac9f\\setup.py'"'"'; __file__='"'"'C:\\Users\\Nitro 5\\AppData\\Local\\Temp\\pip-install-a48eed40\\autopy_364831de627945c491e2f14d454eac9f\\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'"'"'))' install --record 'C:\Users\Nitro 5\AppData\Local\Temp\pip-record-6f8m7fge\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python39\Include\autopy' Check the logs for full command output.
This issue seems to be on Py3.9 but not Py3.8. I just tried both.
The https://pypi.org/project/autopy/ page gives info on how to install autopy in case the standard pip install autopy fails.
According to that page:
First, see if a binary wheel is available for your machine by running:
$ pip install -U autopy
If that fails, install rustup [https://rustup.rs/] and then run:
$ rustup default nightly-2019-10-05
$ pip install -U setuptools-rust
$ pip install -U autopy
The above just did the trick for me on Py3.9.
I had several times to install autopy; I can't. Because my python version was 3.9; Only 3.8 can install autopy. I tried this and my autopy get installed.
If you want more versions of autopy, you checkout https://pypi.org/project/autopy/
Thanks.

How to pip install a package from a read-only directory?

I am trying to install a Python (C-extension, if it matters) package that is located in a mounted directory, which for security reasons is read-only. However, by default pip will build the package in a subdirectory called build in its own location, which I can't.
$ pip install /mnt/remote/pkgname
Processing /mnt/remote/pkgname
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pkgname, since package 'wheel' is not installed.
Installing collected packages: pkgname
Attempting uninstall: pkgname
Found existing installation: pkgname 1.0.0
Uninstalling pkgname-1.0.0:
Successfully uninstalled pkgname-1.0.0
Running setup.py install for pkgname ... error
ERROR: Command errored out with exit status 1:
command: /path/to/venv/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/mnt/remote/pkgname/setup.py'"'"'; __file__='"'"'/mnt/remote/pkgname/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'"'"'))' install --record /tmp/pip-record-84ofxq5a/install-record.txt --single-version-externally-managed --compile --install-headers /path/to/venv/include/site/python3.8/pkgname
cwd: /mnt/remote/pkgname/
Complete output (6 lines):
running install
running build
running build_ext
building '_pkgname' extension
creating build
error: could not create 'build': Read-only file system
----------------------------------------
Rolling back uninstall of pkgname
Moving to /path/to/venv/lib/python3.8/site-packages/_pkgname.cpython-38-x86_64-linux-gnu.so
from /tmp/pip-uninstall-6pwxs8h_/_pkgname.cpython-38-x86_64-linux-gnu.so
Moving to /path/to/venv/lib/python3.8/site-packages/pkgname-1.0.0.egg-info
from /path/to/venv/lib/python3.8/site-packages/~lclib-1.0.0.egg-info
ERROR: Command errored out with exit status 1: /path/to/venv/bin/python3.8 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/mnt/remote/pkgname/setup.py'"'"'; __file__='"'"'/mnt/remote/pkgname/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'"'"'))' install --record /tmp/pip-record-84ofxq5a/install-record.txt --single-version-externally-managed --compile --install-headers /path/to/venv/include/site/python3.8/pkgname Check the logs for full command output.
I've tried to use combinations of the flags -e, --target <dir>, --src, but none of them changed the output.
Is there a way to compile the package without having to copy the folder locally?
Edit
I've just noticed there is a long discussion on this issue in https://github.com/pypa/pip/issues/10587.
A temporary solution is to run it with a deprecated option:
$ pip install --use-deprecated=out-of-tree-build /mnt/remote/pkgname
But this flag is set to stop working in version 22.1. I still need a long-term solution, and that issue link is probably where we'll get it.
you could use pip install -b customized_build_directory to specify another directory as build base directory, for example /tmp.

Failed to build wheel with autopy

I was bored recently so I decided to do some programming and follow this tutorial which seemd interesting: https://www.youtube.com/watch?ev=8gPONnGIPgw&t=244s
During it, he installs the autopy module directly from pycharm, however when I try it directly myself from the settings in pycharm it doesn't work and I receive an error.
To combat this I decided to follow the instructions on the main site: https://pypi.org/project/autopy/
I tried the first
pip install autopy
command directly and got a massive error where it first said it failed to build the wheel, and then when it ran the second part setup.py it also gave a massive error saying it also failed.
From there I went to the second option:
rustup default nightly-2019-10-05
pip install -U setuptools-rust
pip install -U autopy
by installing rustup and running the other commands but it still fails and gives the "failed to build wheel" and setup.py failed error messages, the exact same ones as before.
Finally I tried the third option:
git clone git://github.com/autopilot-rs/autopy-rs.git
cd autopy
make
make install
by downloading the repository itself and then going into it and using make(that I installed via chocolatey in the powershell) and running these commands but it also fails.
I've tried all 3 methods and the internet is yielding minimum results, any help here or resources that may help is greatly appreciated.
EDIT:
my apologies I thought I added the error, here it is
Collecting autopy
Using cached autopy-4.0.0.tar.gz (20 kB)
Building wheels for collected packages: autopy
Building wheel for autopy (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\moham\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\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'"'"'))' bdist_wheel -d 'C:\Users\moham\AppData\Local\Temp\pip-wheel-bt_24b82'
cwd: C:\Users\moham\AppData\Local\Temp\pip-install-9plfhi_h\autopy_f9372250d2954cabaa93abb9058afa97\
Complete output (21 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib
creating build\lib\autopy
copying autopy\__init__.py -> build\lib\autopy
running build_ext
running build_rust
error: no override and no default toolchain set
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.
----------------------------------------
ERROR: Failed building wheel for autopy
Running setup.py clean for autopy
ERROR: Command errored out with exit status 1:
command: 'c:\users\moham\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\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'"'"'))' clean --all
cwd: C:\Users\moham\AppData\Local\Temp\pip-install-9plfhi_h\autopy_f9372250d2954cabaa93abb9058afa97
Complete output (18 lines):
running clean
removing 'build\lib' (and everything under it)
'build\bdist.win-amd64' does not exist -- can't clean it
'build\scripts-3.9' does not exist -- can't clean it
removing 'build'
running clean_rust
error: no override and no default toolchain set
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.
----------------------------------------
ERROR: Failed cleaning build dir for autopy
Failed to build autopy
Installing collected packages: autopy
Running setup.py install for autopy ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\moham\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\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'"'"'))' install --record 'C:\Users\moham\AppData\Local\Temp\pip-record-lgc9_ekn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\moham\appdata\local\programs\python\python39\Include\autopy'
cwd: C:\Users\moham\AppData\Local\Temp\pip-install-9plfhi_h\autopy_f9372250d2954cabaa93abb9058afa97\
Complete output (21 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\autopy
copying autopy\__init__.py -> build\lib.win-amd64-3.9\autopy
running build_ext
running build_rust
error: no override and no default toolchain set
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.
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\users\moham\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\setup.py'"'"'; __file__='"'"'C:\\Users\\moham\\AppData\\Local\\Temp\\pip-install-9plfhi_h\\autopy_f9372250d2954cabaa93abb9058afa97\\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'"'"'))' install --record 'C:\Users\moham\AppData\Local\Temp\pip-record-lgc9_ekn\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\moham\appdata\local\programs\python\python39\Include\autopy' Check the logs for full command output.
Looking at the repository for AutoPy, I've found this issue here
Have you tried to use pip install autopy3 for python 3 and above?
Furthermore, autopy uses rust cargo, you can try to clone the following repo and try to build it with Rust (cargo build) on your platform?

How to install Specific version of Spacy

I am trying to install spacy version 2.0.0 it starts downloading, but can not install and give this error.
Found existing installation: cymem 2.0.5
Uninstalling cymem-2.0.5:
Successfully uninstalled cymem-2.0.5
Running setup.py install for cymem ... error
ERROR: Command errored out with exit status 1:
command: 'c:\users\taqi\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\TAQI\\AppData\\Local\\Temp\\pip-install-o890sm67\\cymem_134557a3656d414d8545e96d491823df\\setup.py'"'"'; __file__='"'"'C:\\Users\\TAQI\\AppData\\Local\\Temp\\pip-install-o890sm67\\cymem_134557a3656d414d8545e96d491823df\\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'"'"'))' install --record 'C:\Users\TAQI\AppData\Local\Temp\pip-record-oa_pr0r9\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\taqi\appdata\local\programs\python\python39\Include\cymem'
cwd: C:\Users\TAQI\AppData\Local\Temp\pip-install-o890sm67\cymem_134557a3656d414d8545e96d491823df\
Complete output (17 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\cymem
copying cymem\about.py -> build\lib.win-amd64-3.9\cymem
copying cymem\__init__.py -> build\lib.win-amd64-3.9\cymem
package init file 'cymem\tests\__init__.py' not found (or not a regular file)
creating build\lib.win-amd64-3.9\cymem\tests
copying cymem\tests\test_import.py -> build\lib.win-amd64-3.9\cymem\tests
copying cymem\cymem.pyx -> build\lib.win-amd64-3.9\cymem
copying cymem\cymem.pxd -> build\lib.win-amd64-3.9\cymem
copying cymem\__init__.pxd -> build\lib.win-amd64-3.9\cymem
running build_ext
building 'cymem.cymem' extension
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/
----------------------------------------
Rolling back uninstall of cymem
Moving to c:\users\taqi\appdata\local\programs\python\python39\lib\site-packages\cymem-2.0.5.dist-info
from C:\Users\TAQI\AppData\Local\Programs\Python\Python39\Lib\site-packages~ymem-2.0.5.dist-info
Moving to c:\users\taqi\appdata\local\programs\python\python39\lib\site-packages\cymem
from C:\Users\TAQI\AppData\Local\Programs\Python\Python39\Lib\site-packages~ymem
ERROR: Command errored out with exit status 1: 'c:\users\taqi\appdata\local\programs\python\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\TAQI\AppData\Local\Temp\pip-install-o890sm67\cymem_134557a3656d414d8545e96d491823df\setup.py'"'"'; file='"'"'C:\Users\TAQI\AppData\Local\Temp\pip-install-o890sm67\cymem_134557a3656d414d8545e96d491823df\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'"'"'))' install --record 'C:\Users\TAQI\AppData\Local\Temp\pip-record-oa_pr0r9\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\users\taqi\appdata\local\programs\python\python39\Include\cymem' Check the logs for full command output.
You're trying to install a version that's fairly old (from 2017) and doesn't have binary wheels for python 3.9 (released in 2020). Actually it doesn't have any binary wheels even for older versions of python, so to install it you'd definitely need a compiler. This is probably not what you want.
If you want spaCy v2 instead of spaCy v3, install like this to get the most recent v2.x release (without having to know the exact version number):
pip install "spacy~=2.0"
This is currently spacy==2.3.7.
Similarly, if you need a specific minor version of v2 like v2.3, you can also use ~= to specify that:
pip install "spacy~=2.3.0"
There are only python 3.9 wheels starting at v2.3.3. Otherwise you'll need to install a compiler as described in the docs: https://spacy.io/usage#source

When installing TA-Lib I get the following -> ERROR: Command errored out with exit status 1:

I am trying to install TA-Lib and everything I try does not work. I do not know what package wheel is and why the error references numpy but I am hoping someone can help me.
What I am using:
Python 3.9.2
pip 21.1.1
PS C:\Users\ebben> pip install TA-Lib
Collecting TA-Lib
Using cached TA-Lib-0.4.19.tar.gz (267 kB)
Requirement already satisfied: numpy in c:\python39\lib\site-packages (from TA-Lib) (1.20.2)
Using legacy 'setup.py install' for TA-Lib, since package 'wheel' is not installed.
Installing collected packages: TA-Lib
Running setup.py install for TA-Lib ... error
ERROR: Command errored out with exit status 1:
command: 'c:\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ebben\\AppData\\Local\\Temp\\pip-install-kj0oo9o5\\ta-lib_40a2fa67a4f04799b16fff76025d88fb\\setup.py'"'"'; __file__='"'"'C:\\Users\\ebben\\AppData\\Local\\Temp\\pip-install-kj0oo9o5\\ta-lib_40a2fa67a4f04799b16fff76025d88fb\\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'"'"'))' install --record 'C:\Users\ebben\AppData\Local\Temp\pip-record-z8tx6fp7\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python39\Include\TA-Lib'
cwd: C:\Users\ebben\AppData\Local\Temp\pip-install-kj0oo9o5\ta-lib_40a2fa67a4f04799b16fff76025d88fb\
Complete output (20 lines):
C:\Users\ebben\AppData\Local\Temp\pip-install-kj0oo9o5\ta-lib_40a2fa67a4f04799b16fff76025d88fb\setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
warnings.warn('Cannot find ta-lib library, installation may fail.')
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.9
creating build\lib.win-amd64-3.9\talib
copying talib\abstract.py -> build\lib.win-amd64-3.9\talib
copying talib\deprecated.py -> build\lib.win-amd64-3.9\talib
copying talib\stream.py -> build\lib.win-amd64-3.9\talib
copying talib\test_abstract.py -> build\lib.win-amd64-3.9\talib
copying talib\test_data.py -> build\lib.win-amd64-3.9\talib
copying talib\test_func.py -> build\lib.win-amd64-3.9\talib
copying talib\test_pandas.py -> build\lib.win-amd64-3.9\talib
copying talib\test_stream.py -> build\lib.win-amd64-3.9\talib
copying talib\__init__.py -> build\lib.win-amd64-3.9\talib
running build_ext
building 'talib._ta_lib' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python39\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ebben\\AppData\\Local\\Temp\\pip-install-kj0oo9o5\\ta-lib_40a2fa67a4f04799b16fff76025d88fb\\setup.py'"'"'; __file__='"'"'C:\\Users\\ebben\\AppData\\Local\\Temp\\pip-install-kj0oo9o5\\ta-lib_40a2fa67a4f04799b16fff76025d88fb\\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'"'"'))' install --record 'C:\Users\ebben\AppData\Local\Temp\pip-record-z8tx6fp7\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python39\Include\TA-Lib' Check the logs for full command output.
TA-Lib is a C-library. You're trying to install a python wrapper for it and it can't find C library during installation. Wrapper prints:
setup.py:71: UserWarning: Cannot find ta-lib library, installation may fail.
So, firstly, install the C library binary, then install python wrapper. Check out Dependencies section at https://mrjbq7.github.io/ta-lib/install.html

Categories

Resources