Torch and torchvision installation

  • python -m venv ENV
  • source ENV/bin/activate
  • wget https://nvidia.box.com/shared/static/i8pukc49h3lhak4kkn67tg9j4goqm0m7.whl -O torch-2.0.0+nv23.05-cp38-cp38-linux_aarch64.whl
  • sudo apt-get install python3-pip libopenblas-base libopenmpi-dev libomp-dev
  • pip3 install Cython
  • pip3 install numpy torch-2.0.0+nv23.05-cp38-cp38-linux_aarch64.whl
  • sudo apt-get install libjpeg-dev zlib1g-dev libpython3-dev libopenblas-dev libavcodec-dev libavformat-dev libswscale-dev
  • git clone --branch v0.15.1 GitHub - pytorch/vision: Datasets, Transforms and Models specific to Computer Vision torchvision
  • cd torchvision
  • export BUILD_VERSION=0.15.1
  • python3 setup.py install --user
    When I try to run python3 setup.py install --user it show
    Building wheel torchvision-0.15.1
    Compiling extensions with following flags:
    FORCE_CUDA: False
    DEBUG: False
    TORCHVISION_USE_PNG: True
    TORCHVISION_USE_JPEG: True
    TORCHVISION_USE_NVJPEG: True
    TORCHVISION_USE_FFMPEG: True
    TORCHVISION_USE_VIDEO_CODEC: True
    NVCC_FLAGS:
    Found PNG library
    Building torchvision with PNG image support
    libpng version: 1.6.37
    libpng include path: /usr/include/libpng16
    Running build on conda-build: False
    Running build on conda: False
    Building torchvision with JPEG image support
    Building torchvision without NVJPEG image support
    Building torchvision without ffmpeg support
    Building torchvision without video codec support
    running install
    Checking .pth file support in /home/mic-733ao/.local/lib/python3.8/site-packages/
    /home/mic-733ao/data/verilyvision/VV_Por/lpr-exat-exit/ENV/bin/python3 -E -c pass
    TEST FAILED: /home/mic-733ao/.local/lib/python3.8/site-packages/ does NOT support .pth files
    error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read β€œ.pth” files from. The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
/home/mic-733ao/.local/lib/python3.8/site-packages/
and your PYTHONPATH environment variable currently contains:
β€˜β€™
Here are some of your options for correcting the problem:

  • You can choose a different installation directory, i.e., one that is
    on PYTHONPATH or supports .pth files
  • You can add the installation directory to the PYTHONPATH environment
    variable. (It must then also be on PYTHONPATH whenever you run
    Python and want to use the package(s) you are installing.)
  • You can set up the installation directory to support β€œ.pth” files by
    using one of the approaches described here:
    https://setuptools.readthedocs.io/en/latest/easy_install.html#custom-installation-locations
    Please make the appropriate changes for your system and try again.

Hi,

Checking .pth file support in /home/mic-733ao/.local/lib/python3.8/site-packages/
/home/mic-733ao/data/verilyvision/VV_Por/lpr-exat-exit/ENV/bin/python3 -E -c pass
TEST FAILED: /home/mic-733ao/.local/lib/python3.8/site-packages/ does NOT support .pth files
error: bad install directory or PYTHONPATH

This looks related to the virtual environment.
Could you check if setting up the PYTHONPATH helps?
Ex.

$ export PYTHONPATH="${PYTHONPATH}:/home/mic-733ao/.local/lib/python3.8/site-packages/"

Thanks.

1 Like

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