Search code examples
python-3.xscipypackageimporterrorubuntu-20.04

Unable to run NanoPlot due to import error from Scipy


I am new to python and I'm trying to run NanoPlot 1.40.0 on my Ubuntu 20.04.4 LTS. When I try to run NanoPlot I receive this error:

Traceback (most recent call last):
  File "/home/grid/.local/bin/NanoPlot", line 5, in <module>
    from nanoplot.NanoPlot import main
  File "/home/grid/.local/lib/python3.7/site-packages/nanoplot/NanoPlot.py", line 18, in <module>
    from scipy import stats
  File "/usr/lib/python3/dist-packages/scipy/__init__.py", line 119, in <module>
    from scipy._lib._ccallback import LowLevelCallable
  File "/usr/lib/python3/dist-packages/scipy/_lib/_ccallback.py", line 1, in <module>
    from . import _ccallback_c
ImportError: cannot import name '_ccallback_c' from 'scipy._lib' (/usr/lib/python3/dist-packages/scipy/_lib/__init__.py)

Some background info; there was an initial Python2.7 and I upgraded to the python3.7 version - made this my default. Scipy was installed using sudo apt-get install python3-scipy. The version is Scipy 1.3.3

When I installed NanoPlot, it was done using pip and not pip3 with the pip install NanoPlot and then pip install NanoPlot --upgrade

After installation, I got this message

Script nanoplot is installed in home/grid/.local/bin which is not on PATH.

So I then edited the path using nano ~/.bashrc to include home/grid/.local/bin and executed using source ~/.bashrc I checked $PATH to verify the change and the directory was added. But I always receive the callback error. I uninstalled Scipy, reinstalled it, didn't work. Did all the updates, didn't work.

Any help on how I can rectify this callback error would be really appreciated. Thank you in advance for your time!


Solution

  • UPDATE: RESOLVED!

    I uninstalled scipy using sudo apt-get autoremove python3-scipy

    Also did a purge to check if any config files remained sudo apt-get purge python3-scipy

    Reinstalled scipy using pip3 install --user scipy

    Did an update sudo apt-get update

    Uninstalled Nanoplot pip3 uninstall NanoPlot

    Installed it back pip3 install NanoPlot

    Did an upgrade pip3 install NanoPlot --upgrade

    Tested a code NanoPlot -h

    Worked!