napalm-automation-community / napalm-fortios

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ModuleNotFoundError: No module named 'pip.req'

nemmeviu opened this issue · comments

Description of Issue/Question

pip.req does not exists on new pip3 versions, then we can install napalm-fortios with pip like 19.

Did you follow the steps from https://github.com/napalm-automation/napalm#faq

  • Yes
  • No

Setup

napalm-fortios version

(Paste verbatim output from pip freeze | grep napalm-fortios between quotes below)

$ python3.6 -V
Python 3.6.4
$ pip3.6 install napalm-fortios
Collecting napalm-fortios
  Using cached https://files.pythonhosted.org/packages/dc/db/0ceb160da3f8037052aa04ff03c50a9d3806b28f1b0e9929397852f047cf/napalm-fortios-0.4.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-gjcd99ys/napalm-fortios/setup.py", line 6, in <module>
        from pip.req import parse_requirements
    ModuleNotFoundError: No module named 'pip.req'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-gjcd99ys/napalm-fortios/
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

FortiOS version

(Paste verbatim output from get sys status between quotes below)


Steps to Reproduce the Issue

pip3 install --upgrade pip
pip3 install napalm-fortios

Error Traceback

(Paste the complete traceback of the exception between quotes below)


bash-5.0$ wget https://raw.githubusercontent.com/napalm-automation-community/napalm-fortios/develop/setup.py
bash-5.0$ grep parse_re setup.py
from pip.req import parse_requirements
install_reqs = parse_requirements('requirements.txt', session=uuid.uuid1())
bash-5.0$ python3
Python 3.7.3 (default, Apr  3 2019, 21:34:18)
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pip.req import parse_requirements
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pip.req'
>>>

I have the same problem.

As a workaround downgraded pip to 9.0.3

pip install pip==9.0.3

This issue is in place again. How to solve it this time?

(venv) root@i900svnb01:/opt/netbox# pip3 -V
pip 23.0.1 from /opt/netbox/venv/lib/python3.10/site-packages/pip (python 3.10)

(venv) root@i900svnb01:/opt/netbox# pip3 install napalm-fortios
Collecting napalm-fortios
Using cached napalm-fortios-0.4.1.tar.gz (7.0 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/tmp/pip-install-wvcy98dx/napalm-fortios_6978f4e7fc43442b9d7f8aae0ea6d182/setup.py", line 6, in
from pip.req import parse_requirements
ModuleNotFoundError: No module named 'pip.req'
[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.

Same here... There's no way to install this driver on python 3.12.

pip install napalm-fortios --verbose
Using pip 24.0 from C:\Users\alexa\AppData\Local\Programs\Python\Python312\Lib\site-packages\pip (python 3.12)
Collecting napalm-fortios
  Using cached napalm-fortios-0.4.1.tar.gz (7.0 kB)
  Running command python setup.py egg_info
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "C:\Users\alexa\AppData\Local\Temp\pip-install-y2fj2o4t\napalm-fortios_55f488593e6247f89a87540e3dee8bb9\setup.py", line 6, in <module>
      from pip.req import parse_requirements
  ModuleNotFoundError: No module named 'pip.req'
  error: subprocess-exited-with-error

  × python setup.py egg_info 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.
  full command: 'C:\Users\alexa\AppData\Local\Programs\Python\Python312\python.exe' -c '
  exec(compile('"'"''"'"''"'"'
  # This is <pip-setuptools-caller> -- a caller that pip uses to run setup.py
  #
  # - It imports setuptools before invoking setup.py, to enable projects that directly
  #   import from `distutils.core` to work with newer packaging standards.
  # - It provides a clear error message when setuptools is not installed.
  # - It sets `sys.argv[0]` to the underlying `setup.py`, when invoking `setup.py` so
  #   setuptools doesn'"'"'t think the script is `-c`. This avoids the following warning:
  #     manifest_maker: standard file '"'"'-c'"'"' not found".
  # - It generates a shim setup.py, for handling setup.cfg-only projects.
  import os, sys, tokenize

  try:
      import setuptools
  except ImportError as error:
      print(
          "ERROR: Can not execute `setup.py` since setuptools is not available in "
          "the build environment.",
          file=sys.stderr,
      )
      sys.exit(1)

  __file__ = %r
  sys.argv[0] = __file__

  if os.path.exists(__file__):
      filename = __file__
      with tokenize.open(__file__) as f:
          setup_py_code = f.read()
  else:
      filename = "<auto-generated setuptools caller>"
      setup_py_code = "from setuptools import setup; setup()"

  exec(compile(setup_py_code, filename, "exec"))
  '"'"''"'"''"'"' % ('"'"'C:\\Users\\alexa\\AppData\\Local\\Temp\\pip-install-y2fj2o4t\\napalm-fortios_55f488593e6247f89a87540e3dee8bb9\\setup.py'"'"',), "<pip-setuptools-caller>", "exec"))' egg_info --egg-base 'C:\Users\alexa\AppData\Local\Temp\pip-pip-egg-info-u68xxyfk'
  cwd: C:\Users\alexa\AppData\Local\Temp\pip-install-y2fj2o4t\napalm-fortios_55f488593e6247f89a87540e3dee8bb9\
  Preparing metadata (setup.py) ... error
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.