using pip in a venv for running under PyPy?

81 Views Asked by At

This question is to disambiguate a similar yet slightly different one in the way that they fan-out to sub-questions, so I do expect some duplicate votes in the spirit of voting duplicate on anything that's similar enough, but this question is perhaps humbly a tad less ambiguous, and has run into specific issues, which the other one had not.

Let's say we have a python 3.10 project usually run by cpython in a cpython venv (not a virtual-env) where pip is used to install the project's dependencies in the venv.

And now someone wishes to try running some of its mains using PyPy, which now supports python 3.10, on a fresh and separate git clone directory containing the project. What would be the flow for getting that to work? Is something like the following doomed very inherently to result in malfunctioning code?

After inflating the official linux download of pypy for python 3.10 I took the following playful course of action where both the venv and the pip installation of packages all happen under PyPy itself, same as the other mentioned question does:

pypy3.10-v7.3.15-linux64/bin/pypy3 -m ensurepip
pypy3.10-v7.3.15-linux64/bin/pypy3 -m venv .venv.pypy.3.10
source .venv.pypy.3.10/bin/activate
git clone <my project> ...

Then verifying that within this venv it's enough to use python for running PyPy:

python -m pip install -r requirements.txt

This started off surprisingly nicely, before not unexpectedly, some errors came along ... specifically it seems to downgrade the version of numpy specified in requirements.txt and is then failing to build it.

Collecting pytest==7.4.4 (from -r requirements.txt (line 14))
  Using cached pytest-7.4.4-py3-none-any.whl.metadata (7.9 kB)
Collecting protobuf==3.20.3 (from -r requirements.txt (line 17))
  Downloading protobuf-3.20.3-py2.py3-none-any.whl (162 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 162.1/162.1 kB 1.1 MB/s eta 0:00:00
Collecting numpy==1.24.4 (from -r requirements.txt (line 20))
  Downloading numpy-1.24.4.tar.gz (10.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.9/10.9 MB 33.7 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting pandas==2.1.4 (from -r requirements.txt (line 21))
  Downloading pandas-2.1.4.tar.gz (4.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 4.3/4.3 MB 40.6 MB/s eta 0:00:00
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting opencv-python==4.5.5.62 (from -r requirements.txt (line 37))
  Downloading opencv-python-4.5.5.62.tar.gz (89.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 89.9/89.9 MB 17.0 MB/s eta 0:00:00
  Installing build dependencies ... error
  error: subprocess-exited-with-error
  
  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [347 lines of output]
      Ignoring numpy: markers 'python_version == "3.6" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.7" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.8" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version <= "3.9" and sys_platform == "linux" and platform_machine == "aarch64"' don't match your environment
      Ignoring numpy: markers 'python_version <= "3.9" and sys_platform == "darwin" and platform_machine == "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.9" and platform_machine != "aarch64" and platform_machine != "arm64"' don't match your environment
      Collecting setuptools
        Downloading setuptools-69.0.3-py3-none-any.whl.metadata (6.3 kB)
      Collecting wheel
        Using cached wheel-0.42.0-py3-none-any.whl.metadata (2.2 kB)
      Collecting scikit-build
        Downloading scikit_build-0.17.6-py3-none-any.whl.metadata (14 kB)
      Collecting cmake
        Downloading cmake-3.28.1-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.metadata (6.3 kB)
      Collecting pip
        Downloading pip-24.0-py3-none-any.whl.metadata (3.6 kB)
      Collecting numpy==1.21.2
        Downloading numpy-1.21.2.zip (10.3 MB)
           ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.3/10.3 MB 22.2 MB/s eta 0:00:00
        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 (from scikit-build)
        Downloading distro-1.9.0-py3-none-any.whl.metadata (6.8 kB)
      Collecting packaging (from scikit-build)
        Using cached packaging-23.2-py3-none-any.whl.metadata (3.2 kB)
      Collecting tomli (from scikit-build)
        Using cached tomli-2.0.1-py3-none-any.whl (12 kB)
      Downloading setuptools-69.0.3-py3-none-any.whl (819 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 819.5/819.5 kB 31.8 MB/s eta 0:00:00
      Using cached wheel-0.42.0-py3-none-any.whl (65 kB)
      Downloading scikit_build-0.17.6-py3-none-any.whl (84 kB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 84.3/84.3 kB 4.6 MB/s eta 0:00:00
      Downloading cmake-3.28.1-py2.py3-none-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (26.3 MB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 26.3/26.3 MB 29.4 MB/s eta 0:00:00
      Downloading pip-24.0-py3-none-any.whl (2.1 MB)
         ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.1/2.1 MB 49.9 MB/s eta 0:00:00
      Downloading distro-1.9.0-py3-none-any.whl (20 kB)
      Using cached packaging-23.2-py3-none-any.whl (53 kB)
      Building wheels for collected packages: numpy
        Building wheel for numpy (pyproject.toml): started
        Building wheel for numpy (pyproject.toml): finished with status 'error'
        error: subprocess-exited-with-error
      
        × Building wheel for numpy (pyproject.toml) did not run successfully.
        │ exit code: 1
        ╰─> [291 lines of output]
            setup.py:63: RuntimeWarning: NumPy 1.21.2 may not yet support Python 3.10.
              warnings.warn(
            Running from numpy source directory.
            Processing numpy/random/_bounded_integers.pxd.in
            Processing numpy/random/_mt19937.pyx
            Processing numpy/random/_pcg64.pyx
            Processing numpy/random/bit_generator.pyx
            Processing numpy/random/_sfc64.pyx
            Processing numpy/random/_common.pyx
            Processing numpy/random/_bounded_integers.pyx.in
            Processing numpy/random/_generator.pyx
            Processing numpy/random/_philox.pyx
            Processing numpy/random/mtrand.pyx
            Cythonizing sources
            blas_opt_info:
            blas_mkl_info:
            customize UnixCCompiler
              libraries mkl_rt not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            blis_info:
              libraries blis not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            openblas_info:
              libraries openblas not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            accelerate_info:
              NOT AVAILABLE
      
            atlas_3_10_blas_threads_info:
            Setting PTATLAS=ATLAS
              libraries tatlas not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            atlas_3_10_blas_info:
              libraries satlas not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            atlas_blas_threads_info:
            Setting PTATLAS=ATLAS
              libraries ptf77blas,ptcblas,atlas not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            atlas_blas_info:
              libraries f77blas,cblas,atlas not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            /tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/system_info.py:2026: UserWarning:
                Optimized (vendor) Blas libraries are not found.
                Falls back to netlib Blas library which has worse performance.
                A better performance should be easily gained by switching
                Blas library.
              if self._calc_info(blas):
            blas_info:
              libraries blas not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            /tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/system_info.py:2026: UserWarning:
                Blas (http://www.netlib.org/blas/) libraries not found.
                Directories to search for the libraries can be specified in the
                numpy/distutils/site.cfg file (section [blas]) or by setting
                the BLAS environment variable.
              if self._calc_info(blas):
            blas_src_info:
              NOT AVAILABLE
      
            /tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/system_info.py:2026: UserWarning:
                Blas (http://www.netlib.org/blas/) sources not found.
                Directories to search for the sources can be specified in the
                numpy/distutils/site.cfg file (section [blas_src]) or by setting
                the BLAS_SRC environment variable.
              if self._calc_info(blas):
              NOT AVAILABLE
      
            non-existing path in 'numpy/distutils': 'site.cfg'
            lapack_opt_info:
            lapack_mkl_info:
              libraries mkl_rt not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            openblas_lapack_info:
              libraries openblas not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            openblas_clapack_info:
              libraries openblas,lapack not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            flame_info:
              libraries flame not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            atlas_3_10_threads_info:
            Setting PTATLAS=ATLAS
              libraries lapack_atlas not found in .venv.pypy.3.10/lib
              libraries tatlas,tatlas not found in .venv.pypy.3.10/lib
              libraries lapack_atlas not found in /usr/local/lib
              libraries tatlas,tatlas not found in /usr/local/lib
              libraries lapack_atlas not found in /usr/lib64
              libraries tatlas,tatlas not found in /usr/lib64
              libraries lapack_atlas not found in /usr/lib
              libraries tatlas,tatlas not found in /usr/lib
              libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
              libraries tatlas,tatlas not found in /usr/lib/x86_64-linux-gnu
            <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
              NOT AVAILABLE
      
            atlas_3_10_info:
              libraries lapack_atlas not found in .venv.pypy.3.10/lib
              libraries satlas,satlas not found in .venv.pypy.3.10/lib
              libraries lapack_atlas not found in /usr/local/lib
              libraries satlas,satlas not found in /usr/local/lib
              libraries lapack_atlas not found in /usr/lib64
              libraries satlas,satlas not found in /usr/lib64
              libraries lapack_atlas not found in /usr/lib
              libraries satlas,satlas not found in /usr/lib
              libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
              libraries satlas,satlas not found in /usr/lib/x86_64-linux-gnu
            <class 'numpy.distutils.system_info.atlas_3_10_info'>
              NOT AVAILABLE
      
            atlas_threads_info:
            Setting PTATLAS=ATLAS
              libraries lapack_atlas not found in .venv.pypy.3.10/lib
              libraries ptf77blas,ptcblas,atlas not found in .venv.pypy.3.10/lib
              libraries lapack_atlas not found in /usr/local/lib
              libraries ptf77blas,ptcblas,atlas not found in /usr/local/lib
              libraries lapack_atlas not found in /usr/lib64
              libraries ptf77blas,ptcblas,atlas not found in /usr/lib64
              libraries lapack_atlas not found in /usr/lib
              libraries ptf77blas,ptcblas,atlas not found in /usr/lib
              libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
              libraries ptf77blas,ptcblas,atlas not found in /usr/lib/x86_64-linux-gnu
            <class 'numpy.distutils.system_info.atlas_threads_info'>
              NOT AVAILABLE
      
            atlas_info:
              libraries lapack_atlas not found in .venv.pypy.3.10/lib
              libraries f77blas,cblas,atlas not found in .venv.pypy.3.10/lib
              libraries lapack_atlas not found in /usr/local/lib
              libraries f77blas,cblas,atlas not found in /usr/local/lib
              libraries lapack_atlas not found in /usr/lib64
              libraries f77blas,cblas,atlas not found in /usr/lib64
              libraries lapack_atlas not found in /usr/lib
              libraries f77blas,cblas,atlas not found in /usr/lib
              libraries lapack_atlas not found in /usr/lib/x86_64-linux-gnu
              libraries f77blas,cblas,atlas not found in /usr/lib/x86_64-linux-gnu
            <class 'numpy.distutils.system_info.atlas_info'>
              NOT AVAILABLE
      
            lapack_info:
              libraries lapack not found in ['.venv.pypy.3.10/lib', '/usr/local/lib', '/usr/lib64', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
              NOT AVAILABLE
      
            /tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/system_info.py:1858: UserWarning:
                Lapack (http://www.netlib.org/lapack/) libraries not found.
                Directories to search for the libraries can be specified in the
                numpy/distutils/site.cfg file (section [lapack]) or by setting
                the LAPACK environment variable.
              return getattr(self, '_calc_info_{}'.format(name))()
            lapack_src_info:
              NOT AVAILABLE
      
            /tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/system_info.py:1858: UserWarning:
                Lapack (http://www.netlib.org/lapack/) sources not found.
                Directories to search for the sources can be specified in the
                numpy/distutils/site.cfg file (section [lapack_src]) or by setting
                the LAPACK_SRC environment variable.
              return getattr(self, '_calc_info_{}'.format(name))()
              NOT AVAILABLE
      
            numpy_linalg_lapack_lite:
              FOUND:
                language = c
                define_macros = [('HAVE_BLAS_ILP64', None), ('BLAS_SYMBOL_SUFFIX', '64_')]
      
            Warning: attempted relative import with no known parent package
            /tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py:275: UserWarning: Unknown distribution option: 'define_macros'
              warnings.warn(msg)
            running bdist_wheel
            running build
            running config_cc
            unifing config_cc, config, build_clib, build_ext, build commands --compiler options
            running config_fc
            unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
            running build_src
            build_src
            building py_modules sources
            creating build
            creating build/src.linux-x86_64-3.10
            creating build/src.linux-x86_64-3.10/numpy
            creating build/src.linux-x86_64-3.10/numpy/distutils
            building library "npymath" sources
            Could not locate executable gfortran
            Could not locate executable f95
            Could not locate executable ifort
            Could not locate executable ifc
            Could not locate executable lf95
            Could not locate executable pgfortran
            Could not locate executable nvfortran
            Could not locate executable f90
            Could not locate executable f77
            Could not locate executable fort
            Could not locate executable efort
            Could not locate executable efc
            Could not locate executable g77
            Could not locate executable g95
            Could not locate executable pathf95
            Could not locate executable nagfor
            Could not locate executable frt
            don't know how to compile Fortran code on platform 'posix'
            creating build/src.linux-x86_64-3.10/numpy/core
            creating build/src.linux-x86_64-3.10/numpy/core/src
            creating build/src.linux-x86_64-3.10/numpy/core/src/npymath
            conv_template:> build/src.linux-x86_64-3.10/numpy/core/src/npymath/npy_math_internal.h
              adding 'build/src.linux-x86_64-3.10/numpy/core/src/npymath' to include_dirs.
            conv_template:> build/src.linux-x86_64-3.10/numpy/core/src/npymath/ieee754.c
            conv_template:> build/src.linux-x86_64-3.10/numpy/core/src/npymath/npy_math_complex.c
            None - nothing done with h_files = ['build/src.linux-x86_64-3.10/numpy/core/src/npymath/npy_math_internal.h']
            building library "npyrandom" sources
            building extension "numpy.core._multiarray_tests" sources
            creating build/src.linux-x86_64-3.10/numpy/core/src/multiarray
            conv_template:> build/src.linux-x86_64-3.10/numpy/core/src/multiarray/_multiarray_tests.c
            building extension "numpy.core._multiarray_umath" sources
            Traceback (most recent call last):
              File ".venv.pypy.3.10/lib/pypy3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
                main()
              File ".venv.pypy.3.10/lib/pypy3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
                json_out['return_val'] = hook(**hook_input['kwargs'])
                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File ".venv.pypy.3.10/lib/pypy3.10/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
                return _build_backend().build_wheel(wheel_directory, config_settings,
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/build_meta.py", line 211, in build_wheel
                return self._build_with_temp_dir(['bdist_wheel'], '.whl',
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/build_meta.py", line 197, in _build_with_temp_dir
                self.run_setup()
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/build_meta.py", line 248, in run_setup
                super(_BuildMetaLegacyBackend,
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/build_meta.py", line 142, in run_setup
                exec(compile(code, __file__, 'exec'), locals())
              File "setup.py", line 448, in <module>
                setup_package()
              File "setup.py", line 440, in setup_package
                setup(**metadata)
              File "/tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/core.py", line 169, in setup
                return old_setup(**new_attr)
                       ^^^^^^^^^^^^^^^^^^^^^
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/__init__.py", line 165, in setup
                return distutils.core.setup(**attrs)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/core.py", line 148, in setup
                dist.run_commands()
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 967, in run_commands
                self.run_command(cmd)
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
                cmd_obj.run()
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/wheel/bdist_wheel.py", line 299, in run
                self.run_command('build')
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
                cmd_obj.run()
              File "/tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/command/build.py", line 61, in run
                old_build.run(self)
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/command/build.py", line 135, in run
                self.run_command(cmd_name)
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/cmd.py", line 313, in run_command
                self.distribution.run_command(command)
              File "/tmp/pip-build-env-ewm3aawn/overlay/lib/pypy3.10/site-packages/setuptools/_distutils/dist.py", line 986, in run_command
                cmd_obj.run()
              File "/tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/command/build_src.py", line 144, in run
                self.build_sources()
              File "/tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/command/build_src.py", line 161, in build_sources
                self.build_extension_sources(ext)
              File "/tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/command/build_src.py", line 318, in build_extension_sources
                sources = self.generate_sources(sources, ext)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "/tmp/pip-install-z2us11cu/numpy_85271cd68ba3401b9503c21b07ece0ed/numpy/distutils/command/build_src.py", line 378, in generate_sources
                source = func(extension, build_dir)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "numpy/core/setup.py", line 434, in generate_config_h
                moredefs, ignored = cocache.check_types(config_cmd, ext, build_dir)
                                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              File "numpy/core/setup.py", line 44, in check_types
                out = check_types(*a, **kw)
                      ^^^^^^^^^^^^^^^^^^^^^
              File "numpy/core/setup.py", line 289, in check_types
                raise SystemError(
            SystemError: Cannot compile 'Python.h'. Perhaps you need to install pypy-dev|pypy-devel.
            [end of output]
      
        note: This error originates from a subprocess, and is likely not a problem with pip.
        ERROR: Failed building wheel for numpy
      Failed to build numpy
      ERROR: Could not build wheels for numpy, 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.

As the error message suggests, I apt installed pypy-dev, started a new terminal session with the same venv, but got the same error, maybe something is being needlessly cached. There's a similar post out there about numpy on PyPy, which I'm hard to interpret.

Also there was one package which pip normally resolves outside of PyPy (in the cPython environments) which probably has no version of itself available for PyPy from it's authors, which I guess is a dead-end:

ERROR: Could not find a version that satisfies the requirement foo (from versions: none)
ERROR: No matching distribution found for foo

So in the overal general case as it applies to PyPy 3.10, is this trajectory at all supposed to work? a PyPy venv installing its project dependencies using pip, all under PyPy 3.10, for a 3.10 language level project?

about venv v.s. virtualenv

in case there's a solid reason why virtualenv affords a working path which venv does not, I'll easily switch over, I've just fallen out of habit by sticking with the standard lib's venv module for a long while (it usually simply works).


disclaimers and insignificant technical notes

* my venv and pip modules for cPython 3.10 have been probably globablly installed through separate platform packages than the python 3.10 installation itself. shouldn't matter as that's orthognoal

** PyPy 3.10 for linux seems to come with it's own venv module OOTB, but for pip I had to first use ensurepip as shown above

*** my project, at least currently and to a small capacity, uses cython3.x which may be an orthogonal concern and I may not expect the cython parts to work with PyPy given the list of caveats for combining cython and PyPy and implied time to adapt them to one another if at all that is tractable for a code base using advanced python language features

0

There are 0 best solutions below