Skip to content

Error with sklearn on installing by pip #54

@wook2014

Description

@wook2014

I am trying to install altanalyze in a conda environment on linux server. I tried to install directly by pip install AltAnalyze but there comes an error:

ERROR: Command errored out with exit status 1:
     command: /data/bioinf/jyuan/miniconda/altanalyse/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-kzJa7S/sklearn/setup.py'"'"'; __file__='"'"'/tmp/pip-install-kzJa7S/sklearn/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-mMZ7G6
         cwd: /tmp/pip-install-kzJa7S/sklearn/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-kzJa7S/sklearn/setup.py", line 9, in <module>
        with open("README.md", encoding='utf-8') as f:
    TypeError: 'encoding' is an invalid keyword argument for this function
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I tried to download the sklearn-0.0.post9.tar.gz , changed the line which occurs the problem according to:
https://stackoverflow.com/questions/12541370/typeerror-encoding-is-an-invalid-keyword-argument-for-this-function
from

with open("README.md", encoding='utf-8') as f:

to

import io
with io.open("README.md", encoding='utf-8') as f:

and install it before altanalyze but it seemed that sklearn is not supported now:

The 'sklearn' PyPI package is deprecated, use 'scikit-learn'
rather than 'sklearn' for pip commands. 

Here is how to fix this error in the main use cases:
- use 'pip install scikit-learn' rather than 'pip install sklearn'
- replace 'sklearn' by 'scikit-learn' in your pip requirements files
  (requirements.txt, setup.py, setup.cfg, Pipfile, etc ...)
- if the 'sklearn' package is used by one of your dependencies,
  it would be great if you take some time to track which package uses
  'sklearn' instead of 'scikit-learn' and report it to their issue tracker
- as a last resort, set the environment variable
  SKLEARN_ALLOW_DEPRECATED_SKLEARN_PACKAGE_INSTALL=True to avoid this error

More information is available at
https://github.com/scikit-learn/sklearn-pypi-package

If the previous advice does not cover your use case, feel free to report it at
https://github.com/scikit-learn/sklearn-pypi-package/issues/new

Is there any update on scikit-learn to fix the problem?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions