pdobsan / pynauty

Isomorphism testing and automorphisms of graphs
Other
55 stars 9 forks source link

Help with canon_label #26

Closed Over-TheRainbow closed 2 years ago

Over-TheRainbow commented 2 years ago

I didn't know where else to ask this, so I'll ask it here. I was trying to get a code demo I found online to work, that uses pynauty's canonical_labelling. I noticed that when I installed pynauty, there is no such function but there is canon_label, but when I replaced the function call, it came up with the error Illegal instruction (when inputting a pynauty Graph into canon_label). After looking around, I saw a test folder, which had a test with canon_label, so I went to the pynauty directory and ran the command pytest, but I also got the error Illegal instruction. I'm not sure if this is an error caused by my misunderstanding of the usage of the function, or some sort of bug, so I am posting this question here. (https://github.com/tvayer/PSCN/blob/master/pscn.py is the file that uses the canonical_labelling)

pdobsan commented 2 years ago

As first step make sure that you are using the most recent version of pynauty, that is 1.1.1

If you still get the error, provide the complete error message, the version of python, and the platform, operating system with versions you are using. Also whether you built pynauty from source or used a binary wheel from pypi.

The program you linked too complicated and has many dependencies. Try to provide as simple an example as you can (preferably just a few lines of code, and a small graph/data).

The isomorphism tests call canon_label but as far as I know all passes, none of the call crashes.

Over-TheRainbow commented 2 years ago

I uninstalled and reinstalled pynauty using pip, and it says "Successfully installed pynauty-1.1.1" (using a wheel from pypi) I am running Ubuntu 20.04 in WSL (since pynauty could not install on Windows 10)

Here is the output of running "pytest" in the directory "pynauty", it lists the python version below as well ========================================================= test session starts ========================================================= platform linux -- Python 3.9.12, pytest-7.1.1, pluggy-1.0.0 rootdir: /home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pynauty collected 33 items

tests/test_autgrp.py Fatal Python error: Illegal instruction

Current thread 0x00007feb474d1180 (most recent call first): File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pynauty/graph.py", line 180 in autgrp File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pynauty/tests/test_autgrp.py", line 20 in test_autgrp File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/python.py", line 192 in pytest_pyfunc_call File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in call File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/python.py", line 1761 in runtest File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/runner.py", line 166 in pytest_runtest_call File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in call File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/runner.py", line 259 in File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/runner.py", line 338 in from_call File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/runner.py", line 258 in call_runtest_hook File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/runner.py", line 219 in call_and_report File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/runner.py", line 130 in runtestprotocol File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/runner.py", line 111 in pytest_runtest_protocol File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in call File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/main.py", line 347 in pytest_runtestloop File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in call File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/main.py", line 322 in _main File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/main.py", line 268 in wrap_session File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/main.py", line 315 in pytest_cmdline_main File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_callers.py", line 39 in _multicall File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_manager.py", line 80 in _hookexec File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/pluggy/_hooks.py", line 265 in call File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/config/init.py", line 164 in main File "/home/linus/miniconda3/envs/summer2022/lib/python3.9/site-packages/_pytest/config/init.py", line 187 in console_main File "/home/linus/miniconda3/envs/summer2022/bin/pytest", line 11 in Illegal instruction (core dumped)

Over-TheRainbow commented 2 years ago

I tried using reinstalling using pip install --no-binary pynauty pynauty

This seems to run the tests fine. I will check if I get any further errors. Thank you!

Over-TheRainbow commented 2 years ago

To summarize, running pip install --upgrade pynauty or pip install pynauty seems to result in problems, probably due to the wheel? But running the other command, pip install --no-binary pynauty pynauty, seems to work.

pdobsan commented 2 years ago

On Wed, May 11, 2022 at 04:35:19PM -0700, Over-TheRainbow wrote:

To summarize, running pip install --upgrade pynauty or pip install pynauty seems to result in problems, probably due to the wheel?

Yes the binary wheels seem to be incompatible with your environment.

But running the other command, pip install --no-binary pynauty pynauty, seems to work.

That (i.e. building from source) would have been my next suggestion too.

A few people reported similar problems in docker images (issues #13 #22). Building from source locally solved these too. My conclusion is to avoid such problems I would distribute the package in source format only in the future.

Thanks for your feedback.