Problems with pycuda installing (tried everything) AGX Orin

Hi I have problem with installing pycuda package on Jetson AGX Orin. I found couple of solutions on your forum but nothing helps. Please if you can help me:
Device: Jetson AGX Orin
Python: version 3.8
Cuda: 11.4

`Collecting pycuda==2021.1
Downloading pycuda-2021.1.tar.gz (1.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.7/1.7 MB 6.4 MB/s eta 0:00:00
Installing build dependencies … done
Getting requirements to build wheel … done
Preparing metadata (pyproject.toml) … done
Collecting pytools>=2011.2 (from pycuda==2021.1)
Using cached pytools-2022.1.14-py2.py3-none-any.whl
Collecting appdirs>=1.4.0 (from pycuda==2021.1)
Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: mako in /usr/lib/python3/dist-packages (from pycuda==2021.1) (1.1.0)
Collecting platformdirs>=2.2.0 (from pytools>=2011.2->pycuda==2021.1)
Using cached platformdirs-3.5.1-py3-none-any.whl (15 kB)
Collecting typing-extensions>=4.0 (from pytools>=2011.2->pycuda==2021.1)
Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB)
Building wheels for collected packages: pycuda
Building wheel for pycuda (pyproject.toml) … error
error: subprocess-exited-with-error

× Building wheel for pycuda (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [158 lines of output]
*************************************************************
*** I have detected that you have not run configure.py.
*************************************************************
*** Additionally, no global config files were found.
*** I will go ahead with the default configuration.
*** In all likelihood, this will not work out.
***
*** See README_SETUP.txt for more information.
***
*** If the build does fail, just re-run configure.py with the
*** correct arguments, and then retry. Good luck!
*************************************************************
*** HIT Ctrl-C NOW IF THIS IS NOT WHAT YOU WANT
*************************************************************
Continuing in 10 seconds…
Continuing in 9 seconds…
Continuing in 8 seconds…
Continuing in 7 seconds…
Continuing in 6 seconds…
Continuing in 5 seconds…
Continuing in 4 seconds…
Continuing in 3 seconds…
Continuing in 2 seconds…
Continuing in 1 seconds…
/tmp/pip-build-env-l4oozb_d/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py:265: UserWarning: Unknown distribution option: ‘test_requires’
warnings.warn(msg)

  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-aarch64-cpython-39
  creating build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/tools.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/autoprimaryctx.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/curandom.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/cumath.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/debug.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/reduction.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/gpuarray.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/__init__.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/compiler.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/_cluda.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/driver.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/_mymako.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/scan.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/characterize.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/elementwise.py -> build/lib.linux-aarch64-cpython-39/pycuda
  copying pycuda/autoinit.py -> build/lib.linux-aarch64-cpython-39/pycuda
  creating build/lib.linux-aarch64-cpython-39/pycuda/gl
  copying pycuda/gl/__init__.py -> build/lib.linux-aarch64-cpython-39/pycuda/gl
  copying pycuda/gl/autoinit.py -> build/lib.linux-aarch64-cpython-39/pycuda/gl
  creating build/lib.linux-aarch64-cpython-39/pycuda/sparse
  copying pycuda/sparse/coordinate.py -> build/lib.linux-aarch64-cpython-39/pycuda/sparse
  copying pycuda/sparse/pkt_build.py -> build/lib.linux-aarch64-cpython-39/pycuda/sparse
  copying pycuda/sparse/cg.py -> build/lib.linux-aarch64-cpython-39/pycuda/sparse
  copying pycuda/sparse/__init__.py -> build/lib.linux-aarch64-cpython-39/pycuda/sparse
  copying pycuda/sparse/inner.py -> build/lib.linux-aarch64-cpython-39/pycuda/sparse
  copying pycuda/sparse/operator.py -> build/lib.linux-aarch64-cpython-39/pycuda/sparse
  copying pycuda/sparse/packeted.py -> build/lib.linux-aarch64-cpython-39/pycuda/sparse
  creating build/lib.linux-aarch64-cpython-39/pycuda/compyte
  copying pycuda/compyte/dtypes.py -> build/lib.linux-aarch64-cpython-39/pycuda/compyte
  copying pycuda/compyte/__init__.py -> build/lib.linux-aarch64-cpython-39/pycuda/compyte
  copying pycuda/compyte/array.py -> build/lib.linux-aarch64-cpython-39/pycuda/compyte
  running egg_info
  writing pycuda.egg-info/PKG-INFO
  writing dependency_links to pycuda.egg-info/dependency_links.txt
  writing requirements to pycuda.egg-info/requires.txt
  writing top-level names to pycuda.egg-info/top_level.txt
  reading manifest file 'pycuda.egg-info/SOURCES.txt'
  reading manifest template 'MANIFEST.in'
  warning: no files found matching 'doc/source/_static/*.css'
  warning: no files found matching 'doc/source/_templates/*.html'
  warning: no files found matching '*.cpp' under directory 'bpl-subset/bpl_subset/boost'
  warning: no files found matching '*.html' under directory 'bpl-subset/bpl_subset/boost'
  warning: no files found matching '*.inl' under directory 'bpl-subset/bpl_subset/boost'
  warning: no files found matching '*.txt' under directory 'bpl-subset/bpl_subset/boost'
  warning: no files found matching '*.h' under directory 'bpl-subset/bpl_subset/libs'
  warning: no files found matching '*.ipp' under directory 'bpl-subset/bpl_subset/libs'
  warning: no files found matching '*.pl' under directory 'bpl-subset/bpl_subset/libs'
  adding license file 'LICENSE'
  writing manifest file 'pycuda.egg-info/SOURCES.txt'
  /tmp/pip-build-env-l4oozb_d/overlay/lib/python3.9/site-packages/setuptools/command/build_py.py:201: _Warning: Package 'pycuda.cuda' is absent from the `packages` configuration.
  !!
  
          ********************************************************************************
          ############################
          # Package would be ignored #
          ############################
          Python recognizes 'pycuda.cuda' as an importable package[^1],
          but it is absent from setuptools' `packages` configuration.
  
          This leads to an ambiguous overall configuration. If you want to distribute this
          package, please make sure that 'pycuda.cuda' is explicitly added
          to the `packages` configuration field.
  
          Alternatively, you can also rely on setuptools' discovery methods
          (for example by using `find_namespace_packages(...)`/`find_namespace:`
          instead of `find_packages(...)`/`find:`).
  
          You can read more about "package discovery" on setuptools documentation page:
  
          - https://setuptools.pypa.io/en/latest/userguide/package_discovery.html
  
          If you don't want 'pycuda.cuda' to be distributed and are
          already explicitly excluding 'pycuda.cuda' via
          `find_namespace_packages(...)/find_namespace` or `find_packages(...)/find`,
          you can try to use `exclude_package_data`, or `include-package-data=False` in
          combination with a more fine grained `package-data` configuration.
  
          You can read more about "package data files" on setuptools documentation page:
  
          - https://setuptools.pypa.io/en/latest/userguide/datafiles.html
  
  
          [^1]: For Python, any directory (with suitable naming) can be imported,
                even if it does not contain any `.py` files.
                On the other hand, currently there is no concept of package data
                directory, all directories are treated like packages.
          ********************************************************************************
  
  !!
    check.warn(importable)
  creating build/lib.linux-aarch64-cpython-39/pycuda/cuda
  copying pycuda/cuda/pycuda-complex-impl.hpp -> build/lib.linux-aarch64-cpython-39/pycuda/cuda
  copying pycuda/cuda/pycuda-complex.hpp -> build/lib.linux-aarch64-cpython-39/pycuda/cuda
  copying pycuda/cuda/pycuda-helpers.hpp -> build/lib.linux-aarch64-cpython-39/pycuda/cuda
  copying pycuda/sparse/pkt_build_cython.pyx -> build/lib.linux-aarch64-cpython-39/pycuda/sparse
  running build_ext
  building '_driver' extension
  creating build/temp.linux-aarch64-cpython-39
  creating build/temp.linux-aarch64-cpython-39/bpl-subset
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/python
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/python/src
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/python/src/converter
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/python/src/object
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/smart_ptr
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/smart_ptr/src
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/system
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/system/src
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/thread
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/thread/src
  creating build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/thread/src/pthread
  creating build/temp.linux-aarch64-cpython-39/src
  creating build/temp.linux-aarch64-cpython-39/src/cpp
  creating build/temp.linux-aarch64-cpython-39/src/wrapper
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -fwrapv -Wall -O3 -DNDEBUG -fPIC -DBOOST_ALL_NO_LIB=1 -DBOOST_THREAD_BUILD_DLL=1 -DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION=1 -DBOOST_PYTHON_SOURCE=1 -Dboost=pycudaboost -DBOOST_THREAD_DONT_USE_CHRONO=1 -DPYGPU_PACKAGE=pycuda -DPYGPU_PYCUDA=1 -DHAVE_CURAND=1 -Isrc/cpp -Ibpl-subset/bpl_subset -I/usr/local/cuda-11.4/include -I/tmp/pip-build-env-l4oozb_d/overlay/lib/python3.9/site-packages/numpy/core/include -I/usr/include/python3.9 -c bpl-subset/bpl_subset/libs/python/src/converter/arg_to_python_base.cpp -o build/temp.linux-aarch64-cpython-39/bpl-subset/bpl_subset/libs/python/src/converter/arg_to_python_base.o
  In file included from bpl-subset/bpl_subset/boost/python/detail/prefix.hpp:13,
                   from bpl-subset/bpl_subset/boost/python/handle.hpp:8,
                   from bpl-subset/bpl_subset/boost/python/converter/arg_to_python_base.hpp:7,
                   from bpl-subset/bpl_subset/libs/python/src/converter/arg_to_python_base.cpp:6:
  bpl-subset/bpl_subset/boost/python/detail/wrap_python.hpp:50:11: fatal error: pyconfig.h: No such file or directory
     50 | # include <pyconfig.h>
        |           ^~~~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/aarch64-linux-gnu-gcc' failed with exit code 1
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for pycuda
Failed to build pycuda
ERROR: Could not build wheels for pycuda, which is required to install pyproject.toml-based projects `

I followed steps from Problem installing pycuda with AGX Orin but still is the same error :(

Hi,

Could you check if the file is installed in your environment?

$ sudo find / -iname pyconfig.h

Thanks.

yes, I’ve checked.

`/usr/include/python3.8/pyconfig.h
/usr/include/aarch64-linux-gnu/python3.8/pyconfig.h

find: ‘/run/user/1000/gvfs’: Permission denied
find: ‘/run/user/124/gvfs’: Permission denied
`

I also encountered similar problems, please help me

maybe you could try this :

sudo ln -s /usr/include/locale.h /usr/include/xlocale.h

pip install pycuda --user

It was ok with my Jetson AGX Orin.

Pycuda is sometime hard to install. Maybe you could try Cupy wich is at least as fast as Pycuda with numpy capabilities.

Installing Cupy is not really complicated but it is better to try to find some informations before trying anything.

https://docs.cupy.dev/en/stable/install.html

If you have Jetpack 4 installed on your Jetson :

pip install cupy-cuda102 -f https://pip.cupy.dev/aarch64

If you have Jetpack 5 and CUDA 11.2 to 11.8 :

pip install cupy-cuda11x -f https://pip.cupy.dev/aarch64

If you have Jetpack 5 and CUDA 12 :

pip install cupy-cuda12x -f https://pip.cupy.dev/aarch64

You will also need to update scipy :

pip install -U scipy

Alain

thank you, I’ve tried but still the same error

Hi,

Just tried. We can install pycuda with the following command:
Please give it a try.

$ pip3 install pycuda --user
Collecting pycuda
  Using cached pycuda-2022.2.2.tar.gz (1.7 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pytools>=2011.2 (from pycuda)
  Using cached pytools-2022.1.14.tar.gz (74 kB)
  Preparing metadata (setup.py) ... done
Collecting appdirs>=1.4.0 (from pycuda)
  Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
Requirement already satisfied: mako in /usr/lib/python3/dist-packages (from pycuda) (1.1.0)
Collecting platformdirs>=2.2.0 (from pytools>=2011.2->pycuda)
  Using cached platformdirs-3.5.1-py3-none-any.whl (15 kB)
Requirement already satisfied: typing_extensions>=4.0 in ./.local/lib/python3.8/site-packages (from pytools>=2011.2->pycuda) (4.5.0)
Building wheels for collected packages: pycuda, pytools
  Building wheel for pycuda (pyproject.toml) ... done
  Created wheel for pycuda: filename=pycuda-2022.2.2-cp38-cp38-linux_aarch64.whl size=652942 sha256=22e9fae0eb9af39291d393b7139b96b1111170c1b5d86a994635c4292687b822
  Stored in directory: /home/nvidia/.cache/pip/wheels/7b/41/0d/7cecb04af969d283ebe4a69579a8b2baec0d010a1ac4159f7e
  Building wheel for pytools (setup.py) ... done
  Created wheel for pytools: filename=pytools-2022.1.14-py2.py3-none-any.whl size=69855 sha256=1f4a948803f0bc5b4714c10f9af2ef58ce9df4ca099b1dc2fa5c395e556c02d3
  Stored in directory: /home/nvidia/.cache/pip/wheels/cb/fc/a9/1e7e56fe02d7f58eaff555f22e79d4fc2d817012291254bae2
Successfully built pycuda pytools
Installing collected packages: appdirs, platformdirs, pytools, pycuda
Successfully installed appdirs-1.4.4 platformdirs-3.5.1 pycuda-2022.2.2 pytools-2022.1.14

[notice] A new release of pip is available: 23.1.1 -> 23.1.2
[notice] To update, run: python3 -m pip install --upgrade pip

Thanks.

Hi I tried it again, $ pip3 install pycuda --user
but still I got the same error.
Do you have any other suggestion?

Hi @jelena1, from your screenshot, it appears that you are running in a container and/or with conda? You might want to try disabling conda or using the l4t-ml container (which already has PyCUDA/CuPy compiled and installed). Actually, l4t-pytorch and l4t-tensorflow also have PyCUDA installed. You can find their dockerfiles at https://github.com/dusty-nv/jetson-containers

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