Home > OS >  Error while installing python module from github and through local path
Error while installing python module from github and through local path

Time:09-19

I'm trying to install a modified python package from github. When I try to install using python3 setup.py install I'm getting this error

C:\Users\Maaz Shahid\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
C:\Users\Maaz Shahid\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\easy_install.py:144: EasyInstallDeprecationWarning: easy_install command is deprecated. Use build and pip and other standards-based tools.
  warnings.warn(
running bdist_egg
running egg_info
writing obspy.egg-info\PKG-INFO
writing dependency_links to obspy.egg-info\dependency_links.txt
writing entry points to obspy.egg-info\entry_points.txt
writing namespace_packages to obspy.egg-info\namespace_packages.txt
writing requirements to obspy.egg-info\requires.txt
writing top-level names to obspy.egg-info\top_level.txt
reading manifest file 'obspy.egg-info\SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no previously-included files found matching 'appveyor.yml'
no previously-included directories found matching 'obspy\*\docs'
adding license file 'LICENSE.txt'
writing manifest file 'obspy.egg-info\SOURCES.txt'
installing library code to build\bdist.win-amd64\egg
running install_lib
running build_py
C:\Users\Maaz Shahid\AppData\Local\Programs\Python\Python310\lib\site-packages\setuptools\command\build_py.py:202: SetuptoolsDeprecationWarning:     Installing 'obspy.clients.fdsn.tests.data' as data is deprecated, please list it in `packages`.
    !!


  ############################
    # Package would be ignored #
    ############################
    Python recognizes 'obspy.taup.tests.data.TauP_test_data' as an importable package,
    but it is not listed in the `packages` configuration of setuptools.

    'obspy.taup.tests.data.TauP_test_data' has been automatically added to the distribution only
    because it may contain data files, but this behavior is likely to change
    in future versions of setuptools (and therefore is considered deprecated).

    Please make sure that 'obspy.taup.tests.data.TauP_test_data' is included as a package by using
    the `packages` configuration field or the proper discovery methods
    (for example by using `find_namespace_packages(...)`/`find_namespace:`
    instead of `find_packages(...)`/`find:`).

    You can read more about "package discovery" and "data files" on setuptools
    documentation page.
...
...
...
  check.warn(importable)
running build_ext
building 'gse2' extension
error: Microsoft Visual C   14.0 or greater is required. Get it with "Microsoft C   Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/

When I'm trying to install using pip install -e git https://github.com/isas-yamamoto/obspy.git#egg=obspy

This is the error I'm getting:

  error: subprocess-exited-with-error

  × Building editable for obspy (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [72 lines of output]
      C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\dist.py:262: UserWarning: Unknown distribution option: 'features'
        warnings.warn(msg)
      running editable_wheel
      creating C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info
      writing C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\PKG-INFO
      writing dependency_links to C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\dependency_links.txt
      writing entry points to C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\entry_points.txt
      writing namespace_packages to C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\namespace_packages.txt
      writing requirements to C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\requires.txt
      writing top-level names to C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\top_level.txt
      writing manifest file 'C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\SOURCES.txt'
      reading manifest file 'C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\SOURCES.txt'
      reading manifest template 'MANIFEST.in'
      warning: no previously-included files found matching 'appveyor.yml'
      no previously-included directories found matching 'obspy\*\docs'
      adding license file 'LICENSE.txt'
      writing manifest file 'C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy.egg-info\SOURCES.txt'
      creating 'C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy-1.3.0.post0 20.g5a3b135ba1.isas.yamamoto.feature.apollo.dist-info'
      adding license file "LICENSE.txt" (matched pattern "LICEN[CS]E*")
      C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\normal\Lib\site-packages\wheel\bdist_wheel.py:80: RuntimeWarning: Config variable 'Py_DEBUG' is unset, Python ABI tag may be incorrect
        if get_flag('Py_DEBUG',
      creating C:\Users\Maaz Shahid\AppData\Local\Temp\pip-wheel-l704kmul\tmp4izgban0\obspy-1.3.0.post0 20.g5a3b135ba1.isas.yamamoto.feature.apollo.dist-info\WHEEL
      C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build_py
      running build_ext
      building 'gse2' extension
      Traceback (most recent call last):
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 140, in run
          self._create_wheel_file(bdist_wheel)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 330, in _create_wheel_file
          files, mapping = self._run_build_commands(dist_name, unpacked, lib, tmp)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 261, in _run_build_commands
          self._run_build_subcommands()
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\command\editable_wheel.py", line 288, in _run_build_subcommands
          self.run_command(name)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 319, in run_command
          self.distribution.run_command(command)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\dist.py", line 1217, in run_command
          super().run_command(command)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 992, in run_command
          cmd_obj.run()
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 84, in run
          _build_ext.run(self)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 346, in run
          self.build_extensions()
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 466, in build_extensions
          self._build_extensions_serial()
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 492, in _build_extensions_serial
          self.build_extension(ext)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 246, in build_extension
          _build_ext.build_extension(self, ext)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 547, in build_extension
          objects = self.compiler.compile(
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 344, in compile
          self.initialize()
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\_distutils\_msvccompiler.py", line 253, in initialize
          vc_env = _get_vc_env(plat_spec)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\msvc.py", line 214, in msvc14_get_vc_env
          return _msvc14_get_vc_env(plat_spec)
        File "C:\Users\Maaz Shahid\AppData\Local\Temp\pip-build-env-qvdwaw5u\overlay\Lib\site-packages\setuptools\msvc.py", line 168, in _msvc14_get_vc_env
          raise distutils.errors.DistutilsPlatformError(
      distutils.errors.DistutilsPlatformError: Microsoft Visual C   14.0 or greater is required. Get it with "Microsoft C   Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
      error: Support for editable installs via PEP 660 was recently introduced
      in `setuptools`. If you are seeing this error, please report to:

      https://github.com/pypa/setuptools/issues

      Meanwhile you can try the legacy behavior by setting an
      environment variable and trying to install again:

      SETUPTOOLS_ENABLE_FEATURES="legacy-editable"
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building editable for obspy
Failed to build obspy
ERROR: Could not build wheels for obspy, which is required to install pyproject.toml-based projects

I need this particular modified module,here is the github repo link: https://github.com/isas-yamamoto/obspy/tree/feature/alsep_format_support

Note: this modified repo is many commits behind the master of the original repo

CodePudding user response:

It looks like you are pip installing everything to your main python on your windows machine and packages might have conflicting dependencies. Expanding on my comment in the original post, I would suggest using virtual environments when installing python modules to avoid such headaches. Here is a link that shows multiple ways to isolate a virtual environment. There is also conda that predates pip that has isolation and python module management all in one, but for this error you are seeing I will give an example with python module venv. For now I can give an example using command prompt. Open command prompt and make a new folder that is easily accessible in your file explorer:

C:\Users\kyrlon>cd Documents
C:\Users\kyrlon\Documents>mkdir obspy_example && cd obspy_example
C:\Users\kyrlon\Documents\obspy_example>

Next make a python virtual environment in this directory:

py -m venv py_venv && .\py_venv\Scripts\activate.bat && py -m pip install -e git https://github.com/isas-yamamoto/obspy.git#egg=obspy

This directory now contains an isolated Python. When the name of the Python environment appears in (parenthesis), you know you're in it:

(py_venv) C:\Users\kyrlon\Documents\obspy_example>

Create a file demo_obspy.py in the same directory. If it is difficult to search for your current directory, you can open file explorer from command prompt:

(py_venv) C:\Users\kyrlon\Documents\obspy_example> explorer .

Next open with a code editor of choice:

from obspy import read

print("hello for obspy")

Now back in your command prompt, run python as such:

(py_venv) C:\Users\kyrlon\Documents\obspy_example> py demo_obspy.py

You should now have output:

hello for obspy

with no errors

  • Related