Search code examples
pythonvisual-c++pipanaconda

pip - TypeError: CCompiler_spawn() got an unexpected keyword argument 'env'


I am attempting to install the python package spacepy.

Information: I have Python 3.11, Anaconda, Visual Studio, and Microsoft Visual C++ 2015-2022 Redistributable x64 and x86 installed on my computer. My numpy version is 1.24.3. I am using Windows 11.

Previously, I was getting an error that Microsoft Visual C++ 14.0+ was required and a prompt to download it. After downloading from the link, I get the error in the title.

I have been stuck on this for a few days now, so I would really appreciate any pointers at all. Also, I am not trying to install spacepy to just a specific environment, which is the topic for the other question with this error.

Thanks!

Collecting spacepy
  Using cached spacepy-0.4.1.zip (18.2 MB)
  Installing build dependencies ... error
  error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [334 lines of output]
      Ignoring numpy: markers 'python_version == "3.5"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.6"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.7" and (platform_system != "Darwin" or platform_machine != "arm64")' don't match your environment
      Ignoring numpy: markers 'python_version == "3.7" and platform_system == "Darwin" and platform_machine == "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.8" and (platform_system != "Darwin" or platform_machine != "arm64")' don't match your environment
      Ignoring numpy: markers 'python_version == "3.8" and platform_system == "Darwin" and platform_machine == "arm64"' don't match your environment
      Ignoring numpy: markers 'python_version == "3.9" and (platform_system != "Darwin" or platform_machine != "arm64")' don't match your environment
      Ignoring numpy: markers 'python_version == "3.9" and platform_system == "Darwin" and platform_machine == "arm64"' don't match your environment
      Collecting setuptools
        Obtaining dependency information for setuptools from https://files.pythonhosted.org/packages/b8/49/b3b29c52b09075fb77f69309763a563b4054d5808a3f3b95df3a62ef3d3f/setuptools-68.1.0-py3-none-any.whl.metadata
        Using cached setuptools-68.1.0-py3-none-any.whl.metadata (6.2 kB)
      Collecting wheel
        Obtaining dependency information for wheel from https://files.pythonhosted.org/packages/28/f5/6955d7b3a5d71ce6bac104f9cf98c1b0513ad656cdaca8ea7d579196f771/wheel-0.41.1-py3-none-any.whl.metadata
        Using cached wheel-0.41.1-py3-none-any.whl.metadata (2.2 kB)
      Collecting numpy~=1.21.0
        Using cached numpy-1.21.1.zip (10.3 MB)
        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'
      Using cached setuptools-68.1.0-py3-none-any.whl (805 kB)
      Using cached wheel-0.41.1-py3-none-any.whl (64 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

        [295 lines of output]
        setup.py:63: RuntimeWarning: NumPy 1.21.1 may not yet support Python 3.11.
          warnings.warn(
        Running from numpy source directory.
        Processing numpy/random\_bounded_integers.pxd.in
        Processing numpy/random\bit_generator.pyx
        Processing numpy/random\mtrand.pyx
        Processing numpy/random\_bounded_integers.pyx.in
        Processing numpy/random\_common.pyx
        Processing numpy/random\_generator.pyx
        Processing numpy/random\_mt19937.pyx
        Processing numpy/random\_pcg64.pyx
        Processing numpy/random\_philox.pyx
        Processing numpy/random\_sfc64.pyx
        Cythonizing sources
        blas_opt_info:
        blas_mkl_info:
        No module named 'numpy.distutils._msvccompiler' in numpy.distutils; trying from distutils
        customize MSVCCompiler
          libraries mkl_rt not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        blis_info:
          libraries blis not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        openblas_info:
          libraries openblas not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
        get_default_fcompiler: matching types: '['gnu', 'intelv', 'absoft', 'compaqv', 'intelev', 'gnu95', 'g95', 'intelvem', 'intelem', 'flang']'
        customize GnuFCompiler
        Could not locate executable g77
        Could not locate executable f77
        customize IntelVisualFCompiler
        Could not locate executable ifort
        Could not locate executable ifl
        customize AbsoftFCompiler
        Could not locate executable f90
        customize CompaqVisualFCompiler
        Could not locate executable DF
        customize IntelItaniumVisualFCompiler
        Could not locate executable efl
        customize Gnu95FCompiler
        Could not locate executable gfortran
        Could not locate executable f95
        customize G95FCompiler
        Could not locate executable g95
        customize IntelEM64VisualFCompiler
        customize IntelEM64TFCompiler
        Could not locate executable efort
        Could not locate executable efc
        customize PGroupFlangCompiler
        Could not locate executable flang
        don't know how to compile Fortran code on platform 'nt'
          NOT AVAILABLE

        accelerate_info:
          NOT AVAILABLE

        atlas_3_10_blas_threads_info:
        Setting PTATLAS=ATLAS
          libraries tatlas not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        atlas_3_10_blas_info:
          libraries satlas not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        atlas_blas_threads_info:
        Setting PTATLAS=ATLAS
          libraries ptf77blas,ptcblas,atlas not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        atlas_blas_info:
          libraries f77blas,cblas,atlas not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\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 ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\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

        C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\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 ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        openblas_lapack_info:
          libraries openblas not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        openblas_clapack_info:
          libraries openblas,lapack not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        flame_info:
          libraries flame not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        atlas_3_10_threads_info:
        Setting PTATLAS=ATLAS
          libraries lapack_atlas not found in C:\Users\micay\anaconda3\lib
          libraries tatlas,tatlas not found in C:\Users\micay\anaconda3\lib
          libraries lapack_atlas not found in C:\
          libraries tatlas,tatlas not found in C:\
          libraries lapack_atlas not found in C:\Users\micay\anaconda3\libs
          libraries tatlas,tatlas not found in C:\Users\micay\anaconda3\libs
        <class 'numpy.distutils.system_info.atlas_3_10_threads_info'>
          NOT AVAILABLE

        atlas_3_10_info:
          libraries lapack_atlas not found in C:\Users\micay\anaconda3\lib
          libraries satlas,satlas not found in C:\Users\micay\anaconda3\lib
          libraries lapack_atlas not found in C:\
          libraries satlas,satlas not found in C:\
          libraries lapack_atlas not found in C:\Users\micay\anaconda3\libs
          libraries satlas,satlas not found in C:\Users\micay\anaconda3\libs
        <class 'numpy.distutils.system_info.atlas_3_10_info'>
          NOT AVAILABLE

        atlas_threads_info:
        Setting PTATLAS=ATLAS
          libraries lapack_atlas not found in C:\Users\micay\anaconda3\lib
          libraries ptf77blas,ptcblas,atlas not found in C:\Users\micay\anaconda3\lib
          libraries lapack_atlas not found in C:\
          libraries ptf77blas,ptcblas,atlas not found in C:\
          libraries lapack_atlas not found in C:\Users\micay\anaconda3\libs
          libraries ptf77blas,ptcblas,atlas not found in C:\Users\micay\anaconda3\libs
        <class 'numpy.distutils.system_info.atlas_threads_info'>
          NOT AVAILABLE

        atlas_info:
          libraries lapack_atlas not found in C:\Users\micay\anaconda3\lib
          libraries f77blas,cblas,atlas not found in C:\Users\micay\anaconda3\lib
          libraries lapack_atlas not found in C:\
          libraries f77blas,cblas,atlas not found in C:\
          libraries lapack_atlas not found in C:\Users\micay\anaconda3\libs
          libraries f77blas,cblas,atlas not found in C:\Users\micay\anaconda3\libs
        <class 'numpy.distutils.system_info.atlas_info'>
          NOT AVAILABLE

        lapack_info:
          libraries lapack not found in ['C:\\Users\\micay\\anaconda3\\lib', 'C:\\', 'C:\\Users\\micay\\anaconda3\\libs']
          NOT AVAILABLE

        C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\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

        C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\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
        C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\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.win-amd64-3.11
        creating build\src.win-amd64-3.11\numpy
        creating build\src.win-amd64-3.11\numpy\distutils
        building library "npymath" sources
        Traceback (most recent call last):
          File "C:\Users\micay\anaconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
            main()
          File "C:\Users\micay\anaconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
            json_out['return_val'] = hook(**hook_input['kwargs'])
                                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\anaconda3\Lib\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 "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\build_meta.py", line 211, in build_wheel
            return self._build_with_temp_dir(['bdist_wheel'], '.whl',
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\build_meta.py", line 197, in _build_with_temp_dir
            self.run_setup()
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\build_meta.py", line 249, in run_setup
            self).run_setup(setup_script=setup_script)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\build_meta.py", line 142, in run_setup
            exec(compile(code, __file__, 'exec'), locals())
          File "setup.py", line 447, in <module>
            setup_package()
          File "setup.py", line 439, in setup_package
            setup(**metadata)
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\core.py", line 169, in setup
            return old_setup(**new_attr)
                   ^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\__init__.py", line 165, in setup
            return distutils.core.setup(**attrs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 148, in setup
            dist.run_commands()
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 967, in run_commands
            self.run_command(cmd)
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
            cmd_obj.run()
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\wheel\bdist_wheel.py", line 299, in run
            self.run_command('build')
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
            self.distribution.run_command(command)
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
            cmd_obj.run()
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\build.py", line 61, in run
            old_build.run(self)
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run
            self.run_command(cmd_name)
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 313, in run_command
            self.distribution.run_command(command)
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 986, in run_command
            cmd_obj.run()
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\build_src.py", line 144, in run
            self.build_sources()
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\build_src.py", line 155, in build_sources
            self.build_library_sources(*libname_info)
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\build_src.py", line 288, in build_library_sources
            sources = self.generate_sources(sources, (lib_name, build_info))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\build_src.py", line 378, in generate_sources
            source = func(extension, build_dir)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "numpy\core\setup.py", line 661, in get_mathlib_info
            st = config_cmd.try_link('int main(void) { return 0;}')
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 243, in try_link
            self._link(body, headers, include_dirs,
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\config.py", line 163, in _link
            return self._wrap_method(old_config._link, lang,
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\config.py", line 98, in _wrap_method
            ret = mth(*((self,)+args))
                  ^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 137, in _link
            (src, obj) = self._compile(body, headers, include_dirs, lang)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\config.py", line 106, in _compile
            src, obj = self._wrap_method(old_config._compile, lang,
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\command\config.py", line 98, in _wrap_method
            ret = mth(*((self,)+args))
                  ^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\command\config.py", line 132, in _compile
            self.compiler.compile([src], include_dirs=include_dirs)
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 401, in compile
            self.spawn(args)
          File "C:\Users\micay\AppData\Local\Temp\pip-build-env-mbdvdt9r\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 505, in spawn
            return super().spawn(cmd, env=env)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users\micay\AppData\Local\Temp\pip-install-1t11x0fl\numpy_facc933c81f74178a7fbe363400d38e2\numpy\distutils\ccompiler.py", line 88, in <lambda>
            m = lambda self, *args, **kw: func(self, *args, **kw)
                                          ^^^^^^^^^^^^^^^^^^^^^^^
        TypeError: CCompiler_spawn() got an unexpected keyword argument 'env'
        [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.

The only thing I have seen so far from other questions is that my numpy or setuptools versions might be incorrect, but I haven't been able to resolve any issues by updating them.

edit: Based off of the comment, I tried to use numpy 1.25.2 by using pip to upgrade it and using pip cache purge because I saw that pip was using a cached version of numpy 1.21.1 in my previous attempt. When I tried this, it downloaded numpy 1.21.1 when I ran pip install spacepy.

Upgrading the numpy version caused warning messages, so I tried to switch back. After downloading numpy 1.25.2, pip was unable to find the older numpy versions when I tried to re-install them and Anaconda broke to the degree that it couldn't uninstall itself and its command prompt didn't function when re-downloaded, so I installed just Python 3.11. It downloaded numpy 1.25.2 instead of the 1.24.3 version and pip still cannot downgrade numpy.

Currently, I am looking for a way to force pip to use the version of numpy that I have downloaded and a way to fix pip being unable to find versions of numpy when I try to upgrade it.

Download of numpy and pip Compatibility Warnings:

C:\Users\micay>pip install --upgrade numpy
    Requirement already satisfied: numpy in c:\users\micay\anaconda3\lib\site-packages (1.24.3)
    Collecting numpy
      Obtaining dependency information for numpy from https://files.pythonhosted.org/packages/72/b2/02770e60c4e2f7e158d923ab0dea4e9f146a2dbf267fec6d8dc61d475689/numpy-1.25.2-cp311-cp311-win_amd64.whl.metadata
      Downloading numpy-1.25.2-cp311-cp311-win_amd64.whl.metadata (5.7 kB)
    Downloading numpy-1.25.2-cp311-cp311-win_amd64.whl (15.5 MB)
       ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 15.5/15.5 MB 34.4 MB/s eta 0:00:00
    Installing collected packages: numpy
      Attempting uninstall: numpy
        Found existing installation: numpy 1.24.3
        Uninstalling numpy-1.24.3:
          Successfully uninstalled numpy-1.24.3
    ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
    gensim 4.3.0 requires FuzzyTM>=0.4.0, which is not installed.
    tables 3.8.0 requires blosc2~=2.0.0, which is not installed.
    tables 3.8.0 requires cython>=0.29.21, which is not installed.
    transformers 2.1.1 requires sentencepiece, which is not installed.
    numba 0.57.0 requires numpy<1.25,>=1.21, but you have numpy 1.25.2 which is incompatible.
    Successfully installed numpy-1.25.2

Example of pip not finding numpy versions:

C:\Users\micay>pip3 install --upgrade numpy version==1.24.3
Requirement already satisfied: numpy in c:\users\micay\appdata\local\packages\pythonsoftwarefoundation.python.3.11_qbz5n2kfra8p0\localcache\local-packages\python311\site-packages (1.25.2)
ERROR: Ignored the following versions that require a different python version: 1.21.2 Requires-Python >=3.7,<3.11; 1.21.3 Requires-Python >=3.7,<3.11; 1.21.4 Requires-Python >=3.7,<3.11; 1.21.5 Requires-Python >=3.7,<3.11; 1.21.6 Requires-Python >=3.7,<3.11
ERROR: Could not find a version that satisfies the requirement version==1.24.3 (from versions: 0.1.0, 0.1.1)
ERROR: No matching distribution found for version==1.24.3


Solution

  • Solution: Download the 2023.03-01 version of Anaconda and run pip install spacepy. This will give you spacepy on Python 3.10.

    SpacePy:

    • The issue was that, as of 8-19-2023, the module I was trying to install (spacepy) only provided numpy binary wheels for Python versions 3.6 - 3.10. Anaconda versions after 2023.03-01 use Python 3.11, which meant that pip was trying compile without them. The spacepy documentation recommends installing mingw32 with conda install m2w64-gcc-fortran libpython to do this, but that didn't work for me on Python 3.11. It might work for someone else, though, so I am including it here.
    • Pip using a different version of numpy was not an issue. The spacepy setup does that intentionally, and it does not cause problems with Python versions.
    • The big takeaway from this is that these spacepy install documentations are out of date with the latest Anaconda version and the github ones are slightly more useful.

    CCompiler_spawn() got an unexpected keyword argument 'env':

    • The best explanation I found for this error in relation to numpy is that it is a numpy / setuptools compatibility issue. The suggested solutions were to change the setuptools version or change the SETUPTOOLS_USE_DISTUTILS environment variable to "stdlib". I was unable to perform the first, but the second caused me to get a CPU error instead of the ccompiler error, so it may have partially worked. The information was almost three years out of date and is supposedly fixed, though, so I am going to link to it here in case people can use it to find something more relevant to them.

    Anaconda and Numpy Issues:

    • To fix every re-install of Anaconda having a prompt that could not be found by the system and the default version of numpy on a new Python download being 1.25.2, which broke pip, I had to reset my computer. I did a local reinstall instead of cloud (I don't know if that matters for this,) and I used Dell Support Assist to redownload drivers. If you have to do this, try to find your manufacturer's method of installing drivers instead of generic. I didn't, and I messed up some parts of my computer.