0

I am using a python library that imports a deprecated library. One way to fix this is to change the library source to fix this error (e.g., import six - see Python import error: cannot import name 'six' from 'sklearn.externals' ), but I don't want to do this because it means that I need to have a customized version of the library inside my project.

I would like to know if it is possible to set the PYTHONPATH, or add any line in my project to override the import used in the library.

from sklearn.externals import six
ImportError: cannot import name 'six' from 'sklearn.externals
smci
  • 32,567
  • 20
  • 113
  • 146
xeon123
  • 819
  • 1
  • 10
  • 25
  • 2
    The accepted answer to the question you linked provides your workaround and what line you need to override the import. – Cireo Aug 04 '20 at 23:02
  • 2
    See Cireo’s answer. Also, why don’t you [`import six`](https://github.com/benjaminp/six) directly, instead of fetching a reference from another module? – Jens Aug 04 '20 at 23:04
  • @Jens I believe they don't care about importing `six`, they are trying to use a library which has bad references (likely part of the py27 unsupported apocalypse). – Cireo Aug 04 '20 at 23:08

0 Answers0