pyutils / line_profiler

Line-by-line profiling for Python
Other
2.57k stars 118 forks source link

Will not install, Python 3.10 #162

Open sparrow001 opened 1 year ago

sparrow001 commented 1 year ago

I will just leave the error here:

`error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> [98 lines of output] Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple, https://www.piwheels.org/simple Collecting setuptools>=41.0.1 Using cached https://www.piwheels.org/simple/setuptools/setuptools-65.3.0-py3-none-any.whl (1.2 MB) Collecting wheel Using cached https://www.piwheels.org/simple/wheel/wheel-0.37.1-py2.py3-none-any.whl (35 kB) Collecting Cython Using cached Cython-0.29.32-py2.py3-none-any.whl (986 kB) Collecting scikit-build>=0.9.0 Using cached https://www.piwheels.org/simple/scikit-build/scikit_build-0.15.0-py2.py3-none-any.whl (77 kB) Collecting cmake Using cached cmake-3.24.1.1.tar.gz (33 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 metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting ninja Using cached ninja-1.10.2.3.tar.gz (26 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 metadata (pyproject.toml): started Preparing metadata (pyproject.toml): finished with status 'done' Collecting distro Using cached https://www.piwheels.org/simple/distro/distro-1.7.0-py3-none-any.whl (20 kB) Collecting packaging Using cached https://www.piwheels.org/simple/packaging/packaging-21.3-py3-none-any.whl (40 kB) Collecting pyparsing!=3.0.5,>=2.0.2 Using cached https://www.piwheels.org/simple/pyparsing/pyparsing-3.0.9-py3-none-any.whl (98 kB) Building wheels for collected packages: cmake, ninja Building wheel for cmake (pyproject.toml): started Building wheel for cmake (pyproject.toml): finished with status 'error' error: subprocess-exited-with-error × Building wheel for cmake (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [33 lines of output] File "/tmp/pip-build-env-2gg6rcro/overlay/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 613, in setup cmkr = cmaker.CMaker(cmake_executable) File "/tmp/pip-build-env-2gg6rcro/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 141, in init self.cmake_version = get_cmake_version(self.cmake_executable) File "/tmp/pip-build-env-2gg6rcro/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 95, in get_cmake_version raise SKBuildError( Traceback (most recent call last): =============================DEBUG ASSISTANCE============================= If you are seeing a compilation error please try the following steps to successfully install cmake: 1) Upgrade to the latest pip and try again. This will fix errors for most users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip 2) If on Linux, with glibc < 2.12, you can set PIP_ONLY_BINARY=cmake in order to retrieve the last manylinux1 compatible wheel. 3) If on Linux, with glibc < 2.12, you can cap "cmake<3.23" in your requirements in order to retrieve the last manylinux1 compatible wheel. 4) Open an issue with the debug information that follows at https://github.com/scikit-build/cmake-python-distributions/issues

            Python: 3.10.0
            platform: Linux-5.10.103-v7+-armv7l-with-glibc2.28
            glibc: glibc 2.28
            machine: armv7l
            bits: 32
            pip: n/a
            setuptools: 65.3.0
            scikit-build: 0.15.0
            PEP517_BUILD_BACKEND=setuptools.build_meta
            =============================DEBUG ASSISTANCE=============================

        Problem with the CMake installation, aborting build. CMake executable is cmake
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for cmake
    Building wheel for ninja (pyproject.toml): started
    Building wheel for ninja (pyproject.toml): finished with status 'error'
    error: subprocess-exited-with-error

    × Building wheel for ninja (pyproject.toml) did not run successfully.
    │ exit code: 1
    ╰─> [9 lines of output]
          File "/tmp/pip-build-env-opvu5ey2/overlay/lib/python3.10/site-packages/skbuild/setuptools_wrap.py", line 613, in setup
            cmkr = cmaker.CMaker(cmake_executable)
          File "/tmp/pip-build-env-opvu5ey2/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 141, in __init__
            self.cmake_version = get_cmake_version(self.cmake_executable)
          File "/tmp/pip-build-env-opvu5ey2/overlay/lib/python3.10/site-packages/skbuild/cmaker.py", line 95, in get_cmake_version
            raise SKBuildError(
        Traceback (most recent call last):

        Problem with the CMake installation, aborting build. CMake executable is cmake
        [end of output]

    note: This error originates from a subprocess, and is likely not a problem with pip.
    ERROR: Failed building wheel for ninja
  Failed to build cmake ninja
  ERROR: Could not build wheels for cmake, ninja, which is required to install pyproject.toml-based projects
  [end of output]

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

× pip subprocess to install build dependencies did not run successfully. │ exit code: 1 ╰─> See above for output.

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

Very sorry for the formatting, I can't get it to work

Pip is on the latest version

Erotemic commented 1 year ago

Can you post the error you are getting when you run the pip install command with -v?

sparrow001 commented 1 year ago

Used pastebin this time -

https://pastebin.com/bckaZBKq

Erotemic commented 1 year ago

Hmm, I don't see anything in that message provides any more insight.

Officially, armv7l is not supported, but I'd be interested in fixing that. Has installing line_profiler on armv7l ever worked for you?

What type of machine is this specifically? Is this a Raspberry Pi? Or something else?

My Raspberry Pi grabs the aarch64 wheel when I pip install it, so that's not much help.

Can you pip install cmake, pip install scikit-build, and pip install ninja successfully?

sparrow001 commented 1 year ago

I am using line_profiler because it is a dependency for jishaku, and this package has definitely worked before. Python 3.9 also seems to install it perfectly fine while 3.10 does not.

This is an RPI running Raspbian.

Pip install cmake: errors out like expected Pip install ninja: errors out Pip install scikit-build: installs successfully

Erotemic commented 1 year ago

Looks like this might be an issue with cmake / ninja, which are required to build the newest versions of line_profiler.

sparrow001 commented 1 year ago

Alright, should I open an issue for both packages or just one of them?

Or is there an already built version that I can just copy and paste into the file directories?

Erotemic commented 1 year ago

It might make sense to submit and error to either the cmake package.

In the meantime, I pushed up a PR: https://github.com/pyutils/line_profiler/pull/163 that re-adds support for the original c-extension based method of building the library. If you need a workaround try pulling that down and running: LINE_PROFILER_BUILD_METHOD='cython' python setup.py build_ext --inplace that should avoid the dependency on cmake and scikit-build.

sparrow001 commented 1 year ago

Alright, thank you very much.

CaptainChemist commented 1 year ago

I have this same issue trying to run a pip install in docker of line_profiler on an apple silicon machine. It works fine on a x86 apple or x86 ubuntu machine, which is curious. PIP installing cmake, scikit-build, ninja before doesn't help. Also apt-get installing cmake doesn't help either.

#0 0.285 Using pip 22.3.1 from /opt/conda/lib/python3.10/site-packages/pip (python 3.10)                                                                                                 
#0 0.519 Collecting line-profiler                                                                                                                                                        
#0 0.641   Downloading line_profiler-4.0.2.tar.gz (151 kB)                                                                                                                               
#0 0.711      ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 151.3/151.3 kB 2.1 MB/s eta 0:00:00                                                                                                
#0 0.727   Installing build dependencies: started
#0 0.727   Running command pip subprocess to install build dependencies
#0 1.172   Collecting setuptools>=41.0.1
#0 1.178     Using cached setuptools-66.1.1-py3-none-any.whl (1.3 MB)
#0 1.424   Collecting Cython>=3.0.0a11
#0 1.545     Downloading Cython-3.0.0a11-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl (2.4 MB)
#0 1.809        ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.4/2.4 MB 9.3 MB/s eta 0:00:00
#0 1.943   Installing collected packages: setuptools, Cython
#0 2.660   Successfully installed Cython-3.0.0a11 setuptools-66.1.1
#0 2.660   WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#0 2.724   Installing build dependencies: finished with status 'done'
#0 2.725   Getting requirements to build wheel: started
#0 2.726   Running command Getting requirements to build wheel
#0 3.333   Compiling line_profiler/_line_profiler.pyx because it depends on /tmp/pip-build-env-b7xow64s/overlay/lib/python3.10/site-packages/Cython/Includes/libc/stdint.pxd.
#0 3.333   [1/1] Cythonizing line_profiler/_line_profiler.pyx
#0 3.400   running egg_info
#0 3.400   writing line_profiler.egg-info/PKG-INFO
#0 3.401   writing dependency_links to line_profiler.egg-info/dependency_links.txt
#0 3.401   writing entry points to line_profiler.egg-info/entry_points.txt
#0 3.401   writing requirements to line_profiler.egg-info/requires.txt
#0 3.401   writing top-level names to line_profiler.egg-info/top_level.txt
#0 3.403   file line_profiler.py (for module line_profiler) not found
#0 3.405   reading manifest file 'line_profiler.egg-info/SOURCES.txt'
#0 3.406   reading manifest template 'MANIFEST.in'
#0 3.406   warning: no files found matching '*.md'
#0 3.407   warning: no files found matching 'run_tests.sh'
#0 3.408   warning: no files found matching '*.pyd' under directory 'line_profiler'
#0 3.408   adding license file 'LICENSE.txt'
#0 3.408   adding license file 'LICENSE_Python.txt'
#0 3.409   writing manifest file 'line_profiler.egg-info/SOURCES.txt'
#0 3.519   Getting requirements to build wheel: finished with status 'done'
#0 3.521   Installing backend dependencies: started
#0 3.521   Running command pip subprocess to install backend dependencies
#0 3.860   Collecting wheel
#0 3.861     Using cached wheel-0.38.4-py3-none-any.whl (36 kB)
#0 3.941   Installing collected packages: wheel
#0 3.959   Successfully installed wheel-0.38.4
#0 3.959   WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
#0 4.004   Installing backend dependencies: finished with status 'done'
#0 4.005   Preparing metadata (pyproject.toml): started
#0 4.005   Running command Preparing metadata (pyproject.toml)
#0 4.287   running dist_info
#0 4.289   creating /tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info
#0 4.290   writing /tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info/PKG-INFO
#0 4.290   writing dependency_links to /tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info/dependency_links.txt
#0 4.290   writing entry points to /tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info/entry_points.txt
#0 4.291   writing requirements to /tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info/requires.txt
#0 4.291   writing top-level names to /tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info/top_level.txt
#0 4.291   writing manifest file '/tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info/SOURCES.txt'
#0 4.292   file line_profiler.py (for module line_profiler) not found
#0 4.294   reading manifest file '/tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info/SOURCES.txt'
#0 4.295   reading manifest template 'MANIFEST.in'
#0 4.295   warning: no files found matching '*.md'
#0 4.295   warning: no files found matching 'run_tests.sh'
#0 4.296   warning: no files found matching '*.pyd' under directory 'line_profiler'
#0 4.297   adding license file 'LICENSE.txt'
#0 4.297   adding license file 'LICENSE_Python.txt'
#0 4.297   writing manifest file '/tmp/pip-modern-metadata-h2ayyl09/line_profiler.egg-info/SOURCES.txt'
#0 4.297   creating '/tmp/pip-modern-metadata-h2ayyl09/line_profiler-4.0.2.dist-info'
#0 4.355   Preparing metadata (pyproject.toml): finished with status 'done'
#0 4.412 Building wheels for collected packages: line-profiler
#0 4.413   Building wheel for line-profiler (pyproject.toml): started
#0 4.413   Running command Building wheel for line-profiler (pyproject.toml)
#0 4.706   running bdist_wheel
#0 4.709   running build
#0 4.709   running build_py
#0 4.710   file line_profiler.py (for module line_profiler) not found
#0 4.710   creating build
#0 4.710   creating build/lib.linux-aarch64-cpython-310
#0 4.711   copying kernprof.py -> build/lib.linux-aarch64-cpython-310
#0 4.711   creating build/lib.linux-aarch64-cpython-310/line_profiler
#0 4.711   copying line_profiler/__init__.py -> build/lib.linux-aarch64-cpython-310/line_profiler
#0 4.711   copying line_profiler/ipython_extension.py -> build/lib.linux-aarch64-cpython-310/line_profiler
#0 4.712   copying line_profiler/__main__.py -> build/lib.linux-aarch64-cpython-310/line_profiler
#0 4.712   copying line_profiler/line_profiler.py -> build/lib.linux-aarch64-cpython-310/line_profiler
#0 4.712   file line_profiler.py (for module line_profiler) not found
#0 4.712   running build_ext
#0 4.713   building 'line_profiler._line_profiler' extension
#0 4.713   creating build/temp.linux-aarch64-cpython-310
#0 4.713   creating build/temp.linux-aarch64-cpython-310/line_profiler
#0 4.713   gcc -pthread -B /opt/conda/compiler_compat -Wno-unused-result -Wsign-compare -DNDEBUG -fwrapv -O3 -Wall -fPIC -O3 -isystem /opt/conda/include -fPIC -O3 -isystem /opt/conda/include -fPIC -DCYTHON_TRACE=0 -Iline_profiler -I/opt/conda/include/python3.10 -c line_profiler/_line_profiler.cpp -o build/temp.linux-aarch64-cpython-310/line_profiler/_line_profiler.o
#0 4.719   gcc: fatal error: cannot execute ‘cc1plus’: execvp: No such file or directory
#0 4.721   compilation terminated.
#0 4.721   error: command '/usr/bin/gcc' failed with exit code 1
#0 4.760   error: subprocess-exited-with-error
#0 4.760   
#0 4.760   × Building wheel for line-profiler (pyproject.toml) did not run successfully.
#0 4.760   │ exit code: 1
#0 4.760   ╰─> See above for output.
#0 4.760   
#0 4.760   note: This error originates from a subprocess, and is likely not a problem with pip.
#0 4.760   full command: /opt/conda/bin/python /opt/conda/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py build_wheel /tmp/tmp02kgbh4b
#0 4.760   cwd: /tmp/pip-install-b6fl9l_y/line-profiler_5e36870101bb496c830dc32c919177b2
#0 4.760   Building wheel for line-profiler (pyproject.toml): finished with status 'error'
#0 4.761   ERROR: Failed building wheel for line-profiler
#0 4.761 Failed to build line-profiler
#0 4.761 ERROR: Could not build wheels for line-profiler, which is required to install pyproject.toml-based projects
------
Theelx commented 1 year ago

Huh. @Erotemic, is Apple Silicon being tested in CI? I'll take a look at this.

Theelx commented 1 year ago

@CaptainChemist Can you try installing g++? https://askubuntu.com/questions/637014/gcc-error-trying-to-exec-cc1plus-execvp-no-such-file-or-directory/637029#637029 We should also start building Apple Silicon wheels.

CaptainChemist commented 1 year ago

@Theelx , thank you! I was able to get it working with build-essentials, but g++ works as well and I bet its smaller so I'll definitely use it.

Erotemic commented 1 year ago

@Theelx There aren't any ARM64 wheels built on the CI. I'm not 100% sure if gitlab provides runners for those yet, but I know they are at least on the roadmap (they may be available, but again I'm not sure). I would like to include support for them. If there is an easy way to add it to the CI let me know and I will, but I didn't see one after about 10 minute of googling.

hamedpro commented 10 months ago

idk if my problem is related to this specific issue but when i tried to install requirements of https://github.com/jakevdp/PythonDataScienceHandbook it says line_profiler needs a python version < 3.10 ! its the actual error :

Requirement already satisfied: notebook in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from -r requirements.txt (line 10)) (6.5.1)
ERROR: Ignored the following versions that require a different python version: 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10
ERROR: Could not find a version that satisfies the requirement line_profiler (from versions: none)
ERROR: No matching distribution found for line_profiler
hamedpro commented 10 months ago

actually i found something in /requirements/build.txt which seems to be a bug : as far i understand line 9 of this image below is saying if python version is < 4 and >= 3.11, so use x version of cibuildwheel. this condition seems to never be true!

Screenshot 2023-08-15 at 3 39 23 pm
Erotemic commented 10 months ago

actually i found something in /requirements/build.txt which seems to be a bug : as far i understand line 9 of this image below is saying if python version is < 4 and >= 3.11, so use x version of cibuildwheel. this condition seems to never be true!

It is not a bug. The line in question is:

cibuildwheel>=2.11.2    ; python_version < '4.0'  and python_version >= '3.11'    # Python 3.11+

This basically says when Python is version 3.11 use cibuildwheel>=2.11.2. This pattern is just a fancy way to specify a version of a package for each version of Python. Furthermore, requirements/build.txt is not used unless you pip install line_profiler[build].

If you have an ARM based OSX machine, then you need to install a C++ compiler otherwise line-profiler won't build.

hamedpro commented 10 months ago

@Erotemic

If you have an ARM based OSX machine, then you need to install a C++ compiler otherwise line-profiler won't build.

yeah its a mac. that seems to be my problem. thank you !

its not a bug

you're right, i saw it wrong. i thought that 4 is 3.4 ! and was thinking how its possible for py_version to be <3.4 and >= 3.11 at the same time.

Erotemic commented 2 months ago

@hamedpro ARM osx wheels should now be available for version 4.1.3