I have been trying to install sklearn2pmml using pip
pip install --upgrade sklearn2pmml==0.83.0
pip install --upgrade sklearn2pmml
pip install sklearn2pmml
python3 -m pip install sklearn2pmml

I have tried all variations to pip install command. But I am still getting the same error (shown below)

pip install --upgrade sklearn2pmml==0.83.0
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting sklearn2pmml==0.83.0
  Using cached sklearn2pmml-0.83.0.tar.gz (6.3 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [26 lines of output]
      Traceback (most recent call last):
        File "<string>", line 36, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-4rirpdmx/sklearn2pmml_8f0847b696dd4b058e058b7e1e18cdda/setup.py", line 44, in <module>
          "sklearn-pandas>=0.0.10"
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_distutils/core.py", line 147, in setup
          _setup_distribution = dist = klass(attrs)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/dist.py", line 474, in __init__
          for ep in metadata.entry_points(group='distutils.setup_keywords'):
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 999, in entry_points
          return SelectableGroups.load(eps).select(**params)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 449, in load
          ordered = sorted(eps, key=by_group)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 997, in <genexpr>
          dist.entry_points for dist in unique(distributions())
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/_itertools.py", line 16, in unique_everseen
          k = key(element)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 931, in _normalized_name
          return self._name_from_stem(stem) or super()._normalized_name
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 600, in _normalized_name
          return Prepared.normalize(self.name)
        File "/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/__init__.py", line 855, in normalize
          return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
        File "/opt/pyenv/versions/3.7.4/lib/python3.7/re.py", line 192, in sub
          return _compile(pattern, flags).sub(repl, string, count)
      TypeError: expected string or bytes-like object
      [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.

I have tried installing several versions. I have tried uninstalling py4j and then running it. Installing py4j’s different version and the installing it.

Not sure why I am getting this error.

Has someone faced this issue before?

I have tried installing different versions of the package. I got the same error.

New contributor

Kaushal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

0

I was able to fix this issue by updating

/home/notebook/.local/lib/python3.7/site-packages/setuptools/_vendor/importlib_metadata/init.py

file. I replaced
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_')
with
return re.sub(r"[-_.]+", "-", name).lower().replace('-', '_') if name else ''

I am not sure why but None was getting passed to normalize function.

New contributor

Kaushal is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *