What could be causing install errors with pip, conda and setup.py install

104
April 03, 2022, at 06:20 AM

Whenever I try to install a package with pip or pip3 I get an error that starts with:

DEPRECATION: Configuring installation scheme with distutils config files is deprecated and will no longer work in the near future. If you are using a Homebrew or Linuxbrew Python, please see discussion at https://github.com/Homebrew/homebrew-core/issues/76621

and ends with:

  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in decorator setup command: use_2to3 is invalid.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

using Conda I get the error:

ImportError: dlopen(/Users/user1/miniconda3/lib/python3.8/lib-dynload/_ctypes.cpython-38-darwin.so, 0x0002): Library not loaded: @rpath/libffi.7.dylib
  Referenced from: /Users/user1/miniconda3/lib/python3.8/lib-dynload/_ctypes.cpython-38-darwin.so
  Reason: tried: '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/python3.8/lib-dynload/../../libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/python3.8/lib-dynload/../../libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/bin/../lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/bin/../lib/libffi.7.dylib' (no such file), '/usr/local/lib/libffi.7.dylib' (no such file), '/usr/lib/libffi.7.dylib' (no such file)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1212, in print_unexpected_error_report
    message_builder.append(get_main_info_str(error_report['conda_info']))
  File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/cli/main_info.py", line 237, in get_main_info_str
    info_dict['_' + key] = ('\n' + 26 * ' ').join(info_dict[key])
KeyError: 'pkgs_dirs'
# >>>>>>>>>>>>>>>>>>>>>> ERROR REPORT <<<<<<<<<<<<<<<<<<<<<<
    Traceback (most recent call last):
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/exceptions.py", line 1080, in __call__
        return func(*args, **kwargs)
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/cli/main.py", line 84, in _main
        exit_code = do_call(args, p)
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/cli/conda_argparse.py", line 83, in do_call
        return getattr(module, func_name)(args, parser)
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/cli/main_install.py", line 20, in execute
        install(args, parser, 'install')
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/cli/install.py", line 259, in install
        unlink_link_transaction = solver.solve_for_transaction(
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 114, in solve_for_transaction
        unlink_precs, link_precs = self.solve_for_diff(update_modifier, deps_modifier,
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 157, in solve_for_diff
        final_precs = self.solve_final_state(update_modifier, deps_modifier, prune, ignore_pinned,
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 262, in solve_final_state
        ssc = self._collect_all_metadata(ssc)
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/common/io.py", line 88, in decorated
        return f(*args, **kwds)
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/core/solve.py", line 397, in _collect_all_metadata
        _supplement_index_with_system(virtual_pkg_index)
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/core/index.py", line 159, in _supplement_index_with_system
        cuda_version = context.cuda_version
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/auxlib/decorators.py", line 268, in new_fget
        cache[inner_attname] = func(self)
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/common/decorators.py", line 20, in wrapper
        return func(*args, **kwargs)
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/base/context.py", line 850, in cuda_version
        return cuda_detect()
      File "/Users/user1/miniconda3/lib/python3.8/site-packages/conda/common/cuda.py", line 37, in cuda_detect
        import ctypes
      File "/Users/user1/miniconda3/lib/python3.8/ctypes/__init__.py", line 7, in <module>
        from _ctypes import Union, Structure, Array
    ImportError: dlopen(/Users/user1/miniconda3/lib/python3.8/lib-dynload/_ctypes.cpython-38-darwin.so, 0x0002): Library not loaded: @rpath/libffi.7.dylib
      Referenced from: /Users/user1/miniconda3/lib/python3.8/lib-dynload/_ctypes.cpython-38-darwin.so
      Reason: tried: '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/python3.8/lib-dynload/../../libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/python3.8/lib-dynload/../../libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/bin/../lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/lib/libffi.7.dylib' (no such file), '/Users/user1/miniconda3/bin/../lib/libffi.7.dylib' (no such file), '/usr/local/lib/libffi.7.dylib' (no such file), '/usr/lib/libffi.7.dylib' (no such file)

Are these errors related? What could be causing this type of error. If I install from source (setup.py) the module will install but I'll get an error about a circular import. I've tried installing with sudo, for example using:

sudo -H pip install bat-country

but that doesn't work. If I activate a conda environment I can install with pip within it but I also get the circular import error. conda install does not work from within an environment. Is there anyway to debug this?

Answer 1

I think this may have been an apple silicon issue. I was able to fix the particular error by doing a search for libffi.7.dylib and adding the enclosing folder to package directories using "conda config --file < path to .condarc > --add pkgs_dirs < path to libffi.7.dylib enclosing folder >" or also by coping the contents of the enclosing folder to one of the directories conda said it searched in the error message. This, however, did not fix the numerous other install and import errors I was having. The solution was to download MiniForge from here: (https://github.com/conda-forge/miniforge)and running

chmod +x ~/Downloads/Miniforge3-MacOSX-arm64.sh

sh ~/Downloads/Miniforge3-MacOSX-arm64.sh

source ~/miniforge3/bin/activate

Rent Charter Buses Company
READ ALSO
Snapcraft a conda environment

Snapcraft a conda environment

I have a project that uses a conda environment for dependencies managementFor now, the user can activate the environment and use it (it's exposed to the command line through an entry_point)

160
How to add bounding box coordinates to find depth from Monodepth2 model

How to add bounding box coordinates to find depth from Monodepth2 model

BACKGROUND The Monodepth2 code finds disparity map of an imageAnd from the disparity map it predicts min and max depth values

107
how to make changes to a existing column based on multiple conditions in python csv

how to make changes to a existing column based on multiple conditions in python csv

So I am working on data processing and I want to make changes to a column called "temp_coil" based on the condition in other columns

135
How do I display role members separately from online members?

How do I display role members separately from online members?

I searched for my problem in the API Reference, but I didn't find anything

121