3-manifolds / SnapPy

SnapPy is a package for studying the topology and geometry of 3-manifolds, with a focus on hyperbolic structures. It is based on the SnapPea kernel written by Jeff Weeks.
https://snappy.computop.org/
84 stars 39 forks source link

SnapPy 2.8 crashes on startup: error importing plink.ipython_tools #17

Closed S-Rafael closed 4 years ago

S-Rafael commented 4 years ago

Hi, I'm experiencing a crash in SnapPy 2.8, even though version 2.7 ran just fine on this system. The issue seems to be an import error related to plink, even though I have this module installed, so I'm led to believe it's a bug in SnapPy.

Here's the stderr output of SnapPy: $ SnapPy Traceback (most recent call last): File "/usr/bin/SnapPy", line 5, in from snappy.app import main File "/usr/lib/python3.8/site-packages/snappy/app.py", line 11, in from .gui import * File "/usr/lib/python3.8/site-packages/snappy/gui.py", line 15, in from plink.ipython_tools import IPythonTkRoot ModuleNotFoundError: No module named 'plink.ipython_tools'

Some more information about my config: $ python -m pip list | grep "plink" plink 2.3
$ python --version Python 3.8.3 $ python -m pip list | grep "snappy" snappy 2.8
snappy-manifolds 1.1

Best wishes, Rafael

NathanDunfield commented 4 years ago

Thanks for your report! SnapPy 2.8 requires PLink 2.3.1, Spherogram 1.8.3, and snappy-manifolds 1.1.1, so upgrading PLink should fix this.

How did you install SnapPy? If you used pip, it should have upgraded the dependencies as well (unless you gave it the --no-deps flag).

S-Rafael commented 4 years ago

Thanks for your quick response, Nathan. I did use pip install, without the --no-deps flag. Re-running the pip install command does nothing and prints the already satisfied requirements as follows:

Requirement already up-to-date: snappy in /usr/lib/python3.8/site-packages (2.8) Requirement already satisfied, skipping upgrade: FXrays>=1.3 in /usr/lib/python3.8/site-packages (from snappy) (1.3.3) Requirement already satisfied, skipping upgrade: cypari>=2.2 in /usr/lib/python3.8/site-packages (from snappy) (2.4.0) Requirement already satisfied, skipping upgrade: ipython>=0.13 in /usr/lib/python3.8/site-packages (from snappy) (7.15.0) Requirement already satisfied, skipping upgrade: spherogram>=1.8.3 in /usr/lib/python3.8/site-packages (from snappy) (1.8.3) Requirement already satisfied, skipping upgrade: pypng in /usr/lib/python3.8/site-packages (from snappy) (0.0.20) Requirement already satisfied, skipping upgrade: plink>=2.3.1 in /usr/lib/python3.8/site-packages (from snappy) (2.3.1) Requirement already satisfied, skipping upgrade: future in /usr/lib/python3.8/site-packages (from snappy) (0.18.2) Requirement already satisfied, skipping upgrade: decorator in /usr/lib/python3.8/site-packages (from snappy) (4.4.2) Requirement already satisfied, skipping upgrade: snappy-manifolds>=1.1.1 in /usr/lib/python3.8/site-packages (from snappy) (1.1.1) Requirement already satisfied, skipping upgrade: six in /usr/lib/python3.8/site-packages (from cypari>=2.2->snappy) (1.15.0) Requirement already satisfied, skipping upgrade: networkx>=1.3 in /usr/lib/python3.8/site-packages (from spherogram>=1.8.3->snappy) (2.4)

This is very strange: pip install seems to believe that I already have plink 2.3.1 and all other required packages in sufficiently recent versions. But pip list gives version 2.3 of plink. To investigate which version I really have, I also went ahead and opened the documentation file at "/usr/lib/python3.8/site-packages/plink/doc/index.html" and the HTML <TITLE> tag says "PLink 2.3.1 documentation". Is there some more robust method of checking which plink version I really have, since pip is in two minds about this?

Here's a listing of module directories: $ ls /usr/lib/python3.8/site-packages/ | grep "plink" plink plink-2.3.1.dist-info

NathanDunfield commented 4 years ago

To determine which version of plink Python is finding, as well as where it is located, do

% python3 -c "import plink; print(plink.__version__)"
2.3.1
% python3 -c "import plink; print(plink.__file__)"
/pkgs/pythons/py36/lib/python3.6/site-packages/plink/__init__.py

Possibly you have PLink versions 2.3 and 2.3.1 installed simultaneously, possibly in different locations. I would try running pip uninstall plink several times, until it claims there is nothing for it to remove. Then reinstall plink.

S-Rafael commented 4 years ago

I tried what you suggested and it turned out that I still had plink version 2.3 in $HOME/.local/lib/ which took precedence during import. After removing it, SnapPy correctly loads plink 2.3.1 installed system-wide.

Perhaps we could make the import process more robust by having SnapPy check the version of the module it has just imported before it starts using it? But ultimately the mess in my computer was at fault here. Many thanks for your help!

NathanDunfield commented 4 years ago

Glad to hear this fixed it for you, closing ticket.