Install PyCuda on Jetson NX

Hello!

For inference of trt-engines (they are obtained after onnx format using trtexec) I try to use PyCuda package.

I run this command for install PyCuda:

pip3 install pycuda --user

And I get a lot of erros… Some o fthem are below…

Keyring is skipped due to an exception: Item does not exist!
Collecting pycuda
Downloading pycuda-2021.1.tar.gz (1.7 MB)
|████████████████████████████████| 1.7 MB 530 kB/s
Installing build dependencies … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-hnlymubh/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i Simple index – setuptools wheel ‘numpy; python_version >= ‘"’"‘3.10’"’"’’ ‘numpy==1.19.5; python_version >= ‘"’"‘3.8’"’"’ and python_version < ‘"’"‘3.10’"’"’’ ‘numpy==1.15.4; python_version >= ‘"’"‘3.7’"’"’ and python_version < ‘"’"‘3.8’"’"’’ ‘numpy==1.12.1; python_version < ‘"’"‘3.7’"’"’’
cwd: None
Complete output (2489 lines):
Keyring is skipped due to an exception: Item does not exist!
Ignoring numpy: markers ‘python_version >= “3.10”’ don’t match your environment
Ignoring numpy: markers ‘python_version >= “3.8” and python_version < “3.10”’ don’t match your environment
Ignoring numpy: markers ‘python_version >= “3.7” and python_version < “3.8”’ don’t match your environment
Collecting setuptools

etc…

Nevertheless on the end I get:


WARNING: Discarding https://files.pythonhosted.org/packages/5a/56/4682a5118a234d15aa1c8768a528aac4858c7b04d2674e18d586d3dfda04/pycuda-2021.1.tar.gz#sha256=ab87312d0fc349d9c17294a087bb9615cffcf966ad7b115f5b051008a48dd6ed (from Links for pycuda) (requires-python:~=3.6). Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-hnlymubh/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i Simple index – setuptools wheel ‘numpy; python_version >= ‘"’"‘3.10’"’"’’ ‘numpy==1.19.5; python_version >= ‘"’"‘3.8’"’"’ and python_version < ‘"’"‘3.10’"’"’’ ‘numpy==1.15.4; python_version >= ‘"’"‘3.7’"’"’ and python_version < ‘"’"‘3.8’"’"’’ ‘numpy==1.12.1; python_version < ‘"’"‘3.7’"’"’’ Check the logs for full command output.
Downloading pycuda-2020.1.tar.gz (1.6 MB)
|████████████████████████████████| 1.6 MB 13.9 MB/s
Requirement already satisfied: pytools>=2011.2 in /usr/local/lib/python3.6/dist-packages (from pycuda) (2021.2.7)
Requirement already satisfied: decorator>=3.2.0 in /usr/lib/python3/dist-packages (from pycuda) (4.1.2)
Requirement already satisfied: appdirs>=1.4.0 in /usr/local/lib/python3.6/dist-packages (from pycuda) (1.4.4)
Requirement already satisfied: mako in /usr/lib/python3/dist-packages (from pycuda) (1.0.7)
Requirement already satisfied: numpy>=1.6.0 in /usr/local/lib/python3.6/dist-packages (from pytools>=2011.2->pycuda) (1.19.4)
Requirement already satisfied: dataclasses>=0.7 in /usr/local/lib/python3.6/dist-packages (from pytools>=2011.2->pycuda) (0.8)
Building wheels for collected packages: pycuda
Building wheel for pycuda (setup.py) … done
Created wheel for pycuda: filename=pycuda-2020.1-cp36-cp36m-linux_aarch64.whl size=637057 sha256=900f89fca1be16d3fa4a4e5194fdc4cdc16a9180acc12a91517475c63b578ac7
Stored in directory: /home/alex283h/.cache/pip/wheels/3a/3e/e1/1054e1683e5874983562141f4dd9b5e9f5801b4a8aafab4bef
Successfully built pycuda
Installing collected packages: pycuda
Successfully installed pycuda-2020.1

It looks like th epycuda package as been install…

Could you give me advice how can I install PyCuda without this erros (correctly)?

Ot maybe can I use some another package for inference trt-engines on Jetson NX with Python?

Hi,

Just check the command for NX.
You can install it with the following:

$ sudo apt-get install python3-pip
$ pip3 install Cython
$ pip3 install pycuda --user

Thanks.

This command (pip3 install numpy pycuda --user) gives me the next errors:
pip3 install pycuda --user
Collecting pycuda
Using cached pycuda-2021.1.tar.gz (1.7 MB)
Installing build dependencies … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-yivouqca/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i Simple index – setuptools wheel ‘numpy; python_version >= ‘"’"‘3.10’"’"’’ ‘numpy==1.19.5; python_version >= ‘"’"‘3.8’"’"’ and python_version < ‘"’"‘3.10’"’"’’ ‘numpy==1.15.4; python_version >= ‘"’"‘3.7’"’"’ and python_version < ‘"’"‘3.8’"’"’’ ‘numpy==1.12.1; python_version < ‘"’"‘3.7’"’"’’
cwd: None
Complete output (2488 lines):
Ignoring numpy: markers ‘python_version >= “3.10”’ don’t match your environment
Ignoring numpy: markers ‘python_version >= “3.8” and python_version < “3.10”’ don’t match your environment
Ignoring numpy: markers ‘python_version >= “3.7” and python_version < “3.8”’ don’t match your environment
Collecting setuptools
Using cached setuptools-57.2.0-py3-none-any.whl (818 kB)
Collecting wheel
Using cached wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Collecting numpy==1.12.1
Using cached numpy-1.12.1.zip (4.8 MB)
Building wheels for collected packages: numpy
Building wheel for numpy (setup.py): started
Building wheel for numpy (setup.py): still running…
Building wheel for numpy (setup.py): still running…
Building wheel for numpy (setup.py): still running…
Building wheel for numpy (setup.py): finished with status ‘error’
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-gt4iqm1r/numpy_4ffb26f2b4e3445eb0bec93cb49f69dc/setup.py’"’"’; file=’"’"’/tmp/pip-install-gt4iqm1r/numpy_4ffb26f2b4e3445eb0bec93cb49f69dc/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 /tmp/pip-wheel-ig5n9soi
cwd: /tmp/pip-install-gt4iqm1r/numpy_4ffb26f2b4e3445eb0bec93cb49f69dc/
Complete output (2152 lines):
Running from numpy source directory.
blas_opt_info:
blas_mkl_info:
libraries mkl_rt not found in [’/usr/local/lib’, ‘/usr/lib’, ‘/usr/lib/aarch64-linux-gnu’]
NOT AVAILABLE

blis_info:

…etc…

WARNING: Discarding https://files.pythonhosted.org/packages/5a/56/4682a5118a234d15aa1c8768a528aac4858c7b04d2674e18d586d3dfda04/pycuda-2021.1.tar.gz#sha256=ab87312d0fc349d9c17294a087bb9615cffcf966ad7b115f5b051008a48dd6ed (from Links for pycuda) (requires-python:~=3.6). Command errored out with exit status 1: /usr/bin/python3 /usr/local/lib/python3.6/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-yivouqca/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i Simple index – setuptools wheel ‘numpy; python_version >= ‘"’"‘3.10’"’"’’ ‘numpy==1.19.5; python_version >= ‘"’"‘3.8’"’"’ and python_version < ‘"’"‘3.10’"’"’’ ‘numpy==1.15.4; python_version >= ‘"’"‘3.7’"’"’ and python_version < ‘"’"‘3.8’"’"’’ ‘numpy==1.12.1; python_version < ‘"’"‘3.7’"’"’’ Check the logs for full command output.
Using cached pycuda-2020.1-cp36-cp36m-linux_aarch64.whl
Requirement already satisfied: decorator>=3.2.0 in /usr/lib/python3/dist-packages (from pycuda) (4.1.2)
Requirement already satisfied: mako in /usr/lib/python3/dist-packages (from pycuda) (1.0.7)
Requirement already satisfied: pytools>=2011.2 in /usr/local/lib/python3.6/dist-packages (from pycuda) (2021.2.7)
Requirement already satisfied: appdirs>=1.4.0 in /usr/local/lib/python3.6/dist-packages (from pycuda) (1.4.4)
Requirement already satisfied: numpy>=1.6.0 in /usr/local/lib/python3.6/dist-packages (from pytools>=2011.2->pycuda) (1.19.4)
Requirement already satisfied: dataclasses>=0.7 in /usr/local/lib/python3.6/dist-packages (from pytools>=2011.2->pycuda) (0.8)
Installing collected packages: pycuda
Successfully installed pycuda-2020.1

Now pycuda appeared in list of packages, but I surprised the huge number of errors while install… Is it ok??

Hi,

Please also check Run model engine on Jetson NX win Python for information.

libraries mkl_rt not found in [’/usr/local/lib’, ‘/usr/lib’, ‘/usr/lib/aarch64-linux-gnu’]
NOT AVAILABLE

The error is related to NumPy that complains about a missing library.
To solve this issue, you can install all the dependencies and try it again.

sudo apt-get update
sudo apt-get install -y build-essential libatlas-base-dev
sudo apt-get install libatlas-base-dev gfortran

Since NumPy is a frequently used library, you may already have a workable version in the environment.

Thanks.

Thank you! I will try to do it.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.