davidmcclure / textplot

(Mental) maps of texts with kernel density estimation and force-directed networks.
MIT License
106 stars 35 forks source link

ImportError: cannot import name 'comb' from 'scipy.misc' #5

Open mardub1635 opened 1 year ago

mardub1635 commented 1 year ago

Importation error. Here are the command entered:

marie@marie-macbookpro121: $ python3 -m venv env
marie@marie-macbookpro121: $ . env/bin/activate
(env) marie@marie-macbookpro121: $ pip install -r requirements.txt 
(env) marie@marie-macbookpro121: $  pip install -r requirements.txt 
(env) marie@marie-macbookpro121: $ textplot generate ../ga_i_fotspar.txt removeme.txt
Traceback (most recent call last):
  File "/home/marie/Documents/billing/textplot/env/bin/textplot", line 4, in <module>
    __import__('pkg_resources').run_script('textplot==0.1.1', 'textplot')
  File "/home/marie/Documents/billing/textplot/env/lib/python3.9/site-packages/pkg_resources/__init__.py", line 666, in run_script
    self.require(requires)[0].run_script(script_name, ns)
  File "/home/marie/Documents/billing/textplot/env/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1469, in run_script
    exec(script_code, namespace, namespace)
  File "/home/marie/Documents/billing/textplot/env/lib/python3.9/site-packages/textplot-0.1.1-py3.9.egg/EGG-INFO/scripts/textplot", line 6, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/marie/Documents/billing/textplot/env/lib/python3.9/site-packages/textplot-0.1.1-py3.9.egg/textplot/helpers.py", line 7, in <module>
  File "<frozen zipimport>", line 259, in load_module
  File "/home/marie/Documents/billing/textplot/env/lib/python3.9/site-packages/textplot-0.1.1-py3.9.egg/textplot/matrix.py", line 8, in <module>
ImportError: cannot import name 'comb' from 'scipy.misc' (/home/marie/Documents/billing/textplot/env/lib/python3.9/site-packages/scipy/misc/__init__.py)
simon-20 commented 1 year ago

This error occurs because the author did not fix the versions of the dependences used in requirements.txt to those which were current when textplot was written. As such, when installing, the latest version of each module is installed, and since scipy has been updated with breaking API-changes--specifically, the comb module has been moved to scipy.special location--textplot now fails to run out of the box.

As of July 2023, and perhaps surprisingly, this is the only dependency which has broken, and it can be easily fixed by changing line 8 of matrix.py to from scipy.special import comb.