Error in cmd whlie installing CPPYY on windows - python

I have been trying to install Cppyy on my computerbut I'm new to this so I don't know a whole lot about this I have python and pip install on my computer
C:\WINDOWS\system32>python --version
Python 3.8.6
C:\WINDOWS\system32> pip --version
pip 20.2.3
when I try to run
pip install cppyy
cmd gives me error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-z4gw8trb\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'CPyCppyy==1.11.4; python_implementation != '"'"'PyPy'"'"'' 'cppyy-backend==1.14.0; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling==6.21.3; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling<=6.18.2.3; python_implementation == '"'"'PyPy'"'"'' setuptools wheel
cwd: None
Complete output (42 lines):
Ignoring cppyy-cling: markers 'platform_python_implementation == "PyPy"' don't match your environment
Collecting CPyCppyy==1.11.4
Using cached CPyCppyy-1.11.4.tar.gz (178 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-hj42_3n3\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cppyy-cling>=6.21.3' 'cppyy-backend>=1.14' setuptools wheel
cwd: None
Complete output (31 lines):
Collecting cppyy-cling>=6.21.3
Using cached cppyy_cling-6.21.3-py2.py3-none-win_amd64.whl (18.2 MB)
Collecting cppyy-backend>=1.14
Using cached cppyy-backend-1.14.0.tar.gz (32 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting setuptools
Using cached setuptools-50.3.0-py3-none-any.whl (785 kB)
Collecting wheel
Using cached wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Building wheels for collected packages: cppyy-backend
Building wheel for cppyy-backend (PEP 517): started
Building wheel for cppyy-backend (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip\_vendor\pep517\_in_process.py' build_wheel 'C:\Users\sarfaraz\AppData\Local\Temp\tmpojxb8d41'
cwd: C:\Users\sarfaraz\AppData\Local\Temp\pip-install-znkz3pmg\cppyy-backend
Complete output (6 lines):
running bdist_wheel
running build
running build_ext
checking for build\temp.win-amd64-3.8\Release
creating build\temp.win-amd64-3.8\Release
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: Failed building wheel for cppyy-backend
Failed to build cppyy-backend
ERROR: Could not build wheels for cppyy-backend which use PEP 517 and cannot be installed directly
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-hj42_3n3\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cppyy-cling>=6.21.3' 'cppyy-backend>=1.14' setuptools wheel Check the logs for full command output.
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\sarfaraz\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\python.exe' 'C:\Users\sarfaraz\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\sarfaraz\AppData\Local\Temp\pip-build-env-z4gw8trb\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'CPyCppyy==1.11.4; python_implementation != '"'"'PyPy'"'"'' 'cppyy-backend==1.14.0; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling==6.21.3; python_implementation != '"'"'PyPy'"'"'' 'cppyy-cling<=6.18.2.3; python_implementation == '"'"'PyPy'"'"'' setuptools wheel Check the logs for full command output.
I found some instruction on the site but it was hard for me to follow it since I'm new to this stuff
Thanks in advance

Try to upgrade setuptools wheel
pip install -U setuptools wheel
End then try
pip install cppyy --no-index
If not help, that problem may by with python 3.8
By PyPi it’s supported <=3.7

As shown in the error message and mentioned already by hoefling, you need a system compiler, at the very minimum for system headers, but also for C++ library headers. Cling needs the code from these headers to parse any new C++ code you may give it that uses C++ standard library or Windows system features.
In principle, it's possible to ship a precompiled header with cppyy-cling that contains all system and C++ headers as IR bitcode, but MSVC likes to change header include guards between versions, so that would then only work if there is no system compiler. (It's somewhat better on Linux, but it, too, has changed include guard names in some instances.) This will be revisited once Cling supports precompiled modules (PCMs; as opposed to headers) on Windows. Then these PCMs can be prepackaged and installed conditionally if no system compiler is available. Module support in upstream is, however, still very fresh and not even released yet, so this is something that will only appear in the medium-term.
Anyway, MSVC is free these days. :)

Related

Error When Using Pip To Get Python Packages On Linux Terminal

When I try to install a python package (cryptography in this case) in the Linux terminal, I get an error. I am using Python version 3.8. Here's the code:
Input:
python3.8 -m pip install cryptography or pip install cryptography
Output (anything after "Installing build dependencies ... error" is in RED):
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting cryptography
Using cached cryptography-36.0.1.tar.gz (572 kB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.8
/usr/local/lib/python3.8/site-packages/pip install --ignore-installed
--no-user --prefix /tmp/pip-build-env-j3i9og4s/overlay
--no-warn-script-location --no-binary :none: --only-binary :none: -i
https://pypi.org/simple --extra-index-url
https://www.piwheels.org/simple -- 'setuptools>=40.6.0' wheel
'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"''
'setuptools-rust>=0.11.4'
cwd: None
Complete output (26 lines):
Looking in indexes: https://pypi.org/simple,
https://www.piwheels.org/simple, https://www.piwheels.org/simple
Collecting setuptools>=40.6.0
Using cached setuptools-60.9.3-py3-none-any.whl (1.1 MB)
Collecting wheel
Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Collecting cffi>=1.12
Using cached cffi-1.15.0.tar.gz (484 kB)
ERROR: Command errored out with exit status 1:
command: /usr/local/bin/python3.8 -c 'import sys, setuptools,
tokenize; sys.argv[0] =
'"'"'/tmp/pip-install-9sokml3p/cffi/setup.py'"'"';
__file__='"'"'/tmp/pip-install-9sokml3p/cffi/setup.py'"'"';f=getattr(tokenize,
'"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"',
'"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))'
egg_info --egg-base /tmp/pip-pip-egg-info-5ylb3zxi
cwd: /tmp/pip-install-9sokml3p/cffi/
Complete output (11 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python3.8/site-packages/setuptools/__init__.py",
line 19, in <module>
from setuptools.dist import Distribution
File "/usr/local/lib/python3.8/site-packages/setuptools/dist.py",
line 34, in <module>
from setuptools import windows_support
File "/usr/local/lib/python3.8/site-packages/setuptools/windows_support.py",
line 2, in <module>
import ctypes
File "/usr/local/lib/python3.8/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py
egg_info Check the logs for full command output.
WARNING: You are using pip version 20.1.1; however, version 22.0.3
is available.
You should consider upgrading via the '/usr/local/bin/python3.8 -m
pip install --upgrade pip' command.
----------------------------------------
ERROR: Command errored out with exit status 1:
/usr/local/bin/python3.8 /usr/local/lib/python3.8/site-packages/pip
install --ignore-installed --no-user --prefix
/tmp/pip-build-env-j3i9og4s/overlay --no-warn-script-location
--no-binary :none: --only-binary :none: -i https://pypi.org/simple
--extra-index-url https://www.piwheels.org/simple --
'setuptools>=40.6.0' wheel 'cffi>=1.12; platform_python_implementation
!= '"'"'PyPy'"'"'' 'setuptools-rust>=0.11.4' Check the logs for full
command output.
I don't really understand what this means, and I'd like some assistance installing a package and trying to fix this error. Thanks! -Shane
EDIT: I found near the beginning the text 'Command errored out with exit status 1'
EDIT: I have installed libffi-dev.
Solved by upgrading pip to pip3 using sudo apt-get -y install python3-pip.
Looks like you may need to install libffi-dev. I'm not sure your distro, but it'll be there. Distro is raspbian.
Install with:
apt-get install libffi-dev
There are other questions that looks similar since they have the _ctypes issue, but I won't mark this as a duplicate since your question is exactly the same. I think the underlying root cause is probably the same. See here and here.

pip cannot find build dependencies

I am trying to install some python libraries using
pip install -r requirements
The file looks like:
spacy>=2.1.0,<2.2.0
matplotlib
pandas
networkx
flask
inflect
It was initially giving errors for C++ build tools, but after installing those using the visual studio installer I get the following error.
Collecting spacy<2.2.0,>=2.1.0
Using cached spacy-2.1.9.tar.gz (30.7 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\haris\AppData\Local\Programs\Python\Python38\python.exe'
'C:\Users\haris\AppData\Local\Temp\pip-standalone-pip-iges9uxt\__env_pip__.zip\pip' install --ignore-installed --no-user --prefix
'C:\Users\haris\AppData\Local\Temp\pip-build-env-49g1awc5\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools 'wheel>0.32.0,<0.33.0' Cython 'cymem>=2.0.2,<2.1.0' 'preshed>=2.0.1,<2.1.0' 'murmurhash>=0.28.0,<1.1.0' 'thinc>=7.0.8,<7.1.0'
cwd: None
ERROR: Failed building wheel for blis
Running setup.py clean for blis
Successfully built preshed
Failed to build blis
Do I need to reinstall a newer version of python?

Install TensorFlow Object Detection on Windows Problems

I am trying to install Tensor Flow Object Detection on Windows 10.
Resource: https://towardsdatascience.com/how-to-install-tensorflow-2-object-detection-api-on-windows-2eef9b7ae869
After running these steps, we are receiving the errors below. It is stalling on pyarrow.
How can this be fixed?
protoc object_detection/protos/*.proto --python_out=.
python -m pip install .
Error: Collecting pyarrow<3.0.0,>=0.15.1
Using cached pyarrow-2.0.0.tar.gz (58.9 MB)
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: 'C:\Users\joe.k.smith\AppData\Local\Programs\Python\Python39\python.exe' 'C:\Users\joe.k.smith\AppData\Local\Programs\Python\Python39\lib\site-packages\pip' install --ignore-installed --no-user --prefix 'C:\Users\joe.k.smith\AppData\Local\Temp\pip-build-env-b29td69q\overlay' --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'cython >= 0.29' 'numpy==1.14.5; python_version<'"'"'3.7'"'"'' 'numpy==1.16.0; python_version>='"'"'3.7'"'"'' setuptools setuptools_scm wheel
cwd: None
Complete output (1950 lines):
Ignoring numpy: markers 'python_version < "3.7"' don't match your environment
Collecting cython>=0.29
Using cached Cython-0.29.23-cp39-cp39-win_amd64.whl (1.7 MB)
Collecting numpy==1.16.0
Additional Resources:
https://medium.com/riow/tensorflow-object-detection-on-windows-ad10bfde217c
I'm not exactly sure about that error, but for Tensorflow in general, if you go to this page, you'll see that, as of this writing, the only supported version of python are 3.6 - 3.8. It sounds like for tensorflow/models, you might do well to use 3.7. You will want to make sure you have a compatible version of pip as well.

Beeware 'briefcase create' asks for cairo >= 1.15.10

I'm following Beeware tutorial and unable to 'briefcase create'.
At some point it shows this:
Collecting pygobject>=3.14.0
Downloading PyGObject-3.38.0.tar.gz (712 kB)
|████████████████████████████████| 712 kB 6.9 MB/s
Installing build dependencies ... error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-6esqaemw/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo
cwd: None
Complete output (36 lines):
WARNING: The directory '/home/brutus/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting setuptools
Downloading setuptools-50.3.2-py3-none-any.whl (785 kB)
Collecting wheel
Downloading wheel-0.35.1-py2.py3-none-any.whl (33 kB)
Collecting pycairo
Downloading pycairo-1.20.0.tar.gz (344 kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: pycairo
Building wheel for pycairo (PEP 517): started
Building wheel for pycairo (PEP 517): finished with status 'error'
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmp426eh9du
cwd: /tmp/pip-install-rmj9v5en/pycairo
Complete output (12 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.8/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.8/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.8/cairo
running build_ext
Requested 'cairo >= 1.15.10' but version of cairo is 1.14.6
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
----------------------------------------
ERROR: Failed building wheel for pycairo
Failed to build pycairo
ERROR: Could not build wheels for pycairo which use PEP 517 and cannot be installed directly
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.8 /usr/local/lib/python3.8/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-6esqaemw/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel pycairo Check the logs for full command output.
Unable to install dependencies. This may be because one of your dependencies is invalid, or because pip was unable to connect to the PyPI server.
I believe the main problem is
Requested 'cairo >= 1.15.10' but version of cairo is 1.14.6
But what I don't understand is were is cairo 1.14.6 if I have only cairo 1.20.0 installed.
I tried to update docker, reinstall cairo and pycairo, updated python packages but the error is still there.
The beeware build process is trying to install the pycairo package. This package is just a python interface to the cairo graphics library (libcairo2).
pycairo changelog shows, newest version 1.20.0 for pycairo, which requires cairo (libcairo2) version 1.15.10+.
If you are lucky, you can simply update your cairo package to a version which satisfies the requirement. Info is on the official site cairographics.org/download/.
I have the same problem as you. In my case I am again reminded to upgrade my OS to newer version of Ubuntu, since the cairo package libcairo2 is only available in version 14.6 in Ubuntu 16.04 LTS official PPA. In Ubuntu 20.04 LTS the available libcairo2 is 16.0. I suspect you have a simmilar OS, because your installed cairo version is the same as mine.
You can build the package from source to bypass the error:

Can't install python module with Dockerfile

I am unable to install Flask-User from my requirements file as when it comes to that module I get the error:
Collecting bcrypt>=2.0 (from flask-user->-r requirements.txt (line 8))
Downloading https://files.pythonhosted.org/packages/ce/3a/3d540b9f5ee8d92ce757eebacf167b9deedb8e30aedec69a2a072b2399bb/bcrypt-3.1.6.tar.gz (42kB)
Installing build dependencies: started
Installing build dependencies: finished with status 'error'
Complete output from command /usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vtowffrv/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel "cffi>=1.1; python_implementation != 'PyPy'":
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/82/9c/e812a9838feaf76cd9a960ca4ced3be7f2db31e473677a621d006e128db2/setuptools-40.7.3-py2.py3-none-any.whl (574kB)
Collecting wheel
Downloading https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
Collecting cffi>=1.1
Downloading https://files.pythonhosted.org/packages/e7/a7/4cd50e57cc6f436f1cc3a7e8fa700ff9b8b4d471620629074913e3735fb2/cffi-1.11.5.tar.gz (438kB)
Complete output from command python setup.py egg_info:
No working compiler found, or bogus compiler options passed to
the compiler from Python's standard "distutils" module. See
the error messages above. Likely, the problem is not related
to CFFI but generic to the setup.py of any Python package that
tries to compile C code. (Hints: on OS/X 10.8, for errors about
-mno-fused-madd see http://stackoverflow.com/questions/22313407/
Otherwise, see https://wiki.python.org/moin/CompLangPython or
the IRC channel #python on irc.freenode.net.)
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-wt1ra3xd/cffi/
----------------------------------------
Command "/usr/local/bin/python /usr/local/lib/python3.6/site-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-vtowffrv/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel "cffi>=1.1; python_implementation != 'PyPy'"" failed with error code 1 in None
ERROR: Service 'frontend' failed to build: The command '/bin/sh -c pip install -r requirements.txt' returned a non-zero code: 1
I have tried to upgrade pip, and install setuptools to no avail.
This is my dockerfile:
FROM python:3.6-alpine
WORKDIR /app
COPY requirements.txt /app
COPY app.py /app
COPY templates /app/templates
RUN pip install -r requirements.txt
EXPOSE 5000
ENTRYPOINT ["python"]
CMD ["app.py"]
requirements.txt:
Flask
requests
jsonify
pymongo
request
wtforms
flask-mongoengine
flask-user
Edit:
Appears gcc is not included in the alpine base image.
I resolved this issue by using FROM python:3.6-slim instead.
Appears gcc is not included in the alpine base image. I resolved this issue by using FROM python:3.6-slim instead.

Categories

Resources