libffcv / ffcv

FFCV: Fast Forward Computer Vision (and other ML workloads!)
https://ffcv.io
Apache License 2.0
2.87k stars 179 forks source link

pip install uses system python instead of conda python #373

Closed richardrl closed 7 months ago

richardrl commented 7 months ago

When I try to install ffcv from source (this repo), it uses the system level python instead of conda python. For conda with python3.9 this leads to some bug where it tries to do things with python3.8 (the system level python) in the install.

/samsung4tb/conda_envs/py39/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /samsung4tb/conda_envs/py39/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /samsung4tb/conda_envs/py39/include -fPIC -I/samsung4tb/conda_envs/py39/include/opencv4 -I/samsung4tb/conda_envs/py39/include -I/usr/include/python3.8 -c ./libffcv/libffcv.cpp -o build/temp.linux-x86_64-3.8/./libffcv/libffcv.o

   × python setup.py develop did not run successfully.
    │ exit code: 1
    ╰─> [19 lines of output]
        running develop
        running egg_info
        writing ffcv.egg-info/PKG-INFO
        writing dependency_links to ffcv.egg-info/dependency_links.txt
        writing requirements to ffcv.egg-info/requires.txt
        writing top-level names to ffcv.egg-info/top_level.txt
        warning: Failed to find the configured license file 'LICENSE.txt'
        reading manifest file 'ffcv.egg-info/SOURCES.txt'
        writing manifest file 'ffcv.egg-info/SOURCES.txt'
        running build_ext
        building 'ffcv._libffcv' extension
        /samsung4tb/conda_envs/py39/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /samsung4tb/conda_envs/py39/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /samsung4tb/conda_envs/py39/include -fPIC -I/samsung4tb/conda_envs/py39/include/opencv4 -I/samsung4tb/conda_envs/py39/include -I/usr/include/python3.8 -c ./libffcv/libffcv.cpp -o build/temp.linux-x86_64-3.8/./libffcv/libffcv.o
        In file included from /usr/include/python3.8/Python.h:8,
                         from ./libffcv/libffcv.cpp:2:
        /usr/include/python3.8/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.8/pyconfig.h: No such file or directory
            3 | #  include <x86_64-linux-gnu/python3.8/pyconfig.h>
              |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        compilation terminated.
        error: command '/samsung4tb/conda_envs/py39/bin/x86_64-conda-linux-gnu-cc' failed with exit status 1
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× python setup.py develop did not run successfully.
│ exit code: 1
╰─> [19 lines of output]
    running develop
    running egg_info
    writing ffcv.egg-info/PKG-INFO
    writing dependency_links to ffcv.egg-info/dependency_links.txt
    writing requirements to ffcv.egg-info/requires.txt
    writing top-level names to ffcv.egg-info/top_level.txt
    warning: Failed to find the configured license file 'LICENSE.txt'
    reading manifest file 'ffcv.egg-info/SOURCES.txt'
    writing manifest file 'ffcv.egg-info/SOURCES.txt'
    running build_ext
    building 'ffcv._libffcv' extension
    /samsung4tb/conda_envs/py39/bin/x86_64-conda-linux-gnu-cc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -march=nocona -mtune=haswell -ftree-vectorize -fPIC -fstack-protector-strong -fno-plt -O2 -ffunction-sections -pipe -isystem /samsung4tb/conda_envs/py39/include -DNDEBUG -D_FORTIFY_SOURCE=2 -O2 -isystem /samsung4tb/conda_envs/py39/include -fPIC -I/samsung4tb/conda_envs/py39/include/opencv4 -I/samsung4tb/conda_envs/py39/include -I/usr/include/python3.8 -c ./libffcv/libffcv.cpp -o build/temp.linux-x86_64-3.8/./libffcv/libffcv.o
    In file included from /usr/include/python3.8/Python.h:8,
                     from ./libffcv/libffcv.cpp:2:
    /usr/include/python3.8/pyconfig.h:3:12: fatal error: x86_64-linux-gnu/python3.8/pyconfig.h: No such file or directory
        3 | #  include <x86_64-linux-gnu/python3.8/pyconfig.h>
          |            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    compilation terminated.
    error: command '/samsung4tb/conda_envs/py39/bin/x86_64-conda-linux-gnu-cc' failed with exit status 1
    [end of output]

Notice the -I/usr/include/python3.8 instead of accessing the conda python.

Is there any way to fix this?

richardrl commented 7 months ago

Fixed with: python3 -m pip install -e .

instead of pip install -e.