pyboolnet icon indicating copy to clipboard operation
pyboolnet copied to clipboard

gringo and clasp in Linux on version 3.0.11

Open jcrozum opened this issue 1 year ago • 10 comments

I just upgraded to version 3.0.11 on Linux and got an error because gringo and clasp could not be found. It looks like binaries/linux64/settings.cfg expects them to be packaged with the library, but they are not. When I changed the lines in this file to point to where I have them installed on my system, everything worked as expected.

jcrozum avatar Dec 15 '23 21:12 jcrozum

Are just the clasp / gringo binaries missing? Can you let me know the contents of your local pyboolnet/binaries directory? (mine is ~/.local/lib/python3.10/site-packages/pyboolnet/binaries)

hklarner avatar Dec 19 '23 12:12 hklarner

That's right, it's just the clasp and gringo binaries that are missing, at least compared to what's in the mac64 and win64 folders here. I have the following: image

In the settings.cfg file, the lines

gringo          = ./gringo-4.4.0/gringo
clasp           = ./clasp-3.1.1/clasp-3.1.1-x86-linux

are pointing to files and folders that do not exist.

jcrozum avatar Dec 19 '23 14:12 jcrozum

Can confirm that I've also encountered this issue. I installed PyBoolNet 3.0.11 in a virtual environment within my organization's server. I wonder if the installation was blocked due to permission issues, since I don't have sudo privileges (seems like gringo and clasp need to be installed on the OS). However, there didn't seem to be any errors thrown in the installation process. Then again, there was no indication that gringo or clasp were successfully installed either. The workaround is having my HPC admin install gringo 4.4.0 and clasp 3.1.1 on our system.

@jcrozum is your situation similar?

mallenjon avatar May 05 '24 19:05 mallenjon

I also have this issue on Windows within Google Colab. When trying to run the pyboolnet.state_transition_graphs.add_style_default function I get the following error:

FileNotFoundError Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/pyboolnet/external/potassco.py in potassco_handle(primes, type_, bounds, project, max_output, fname_asp, representation, extra_lines) 44 cmd_gringo = [CMD_GRINGO] ---> 45 proc_gringo = subprocess.Popen(cmd_gringo, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) 46 cmd_clasp = [CMD_CLASP, f"--models={max_output}"] + params_clasp

6 frames FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.10/dist-packages/pyboolnet/binaries/gringo-4.4.0/gringo'

During handling of the above exception, another exception occurred:

Exception Traceback (most recent call last) /usr/local/lib/python3.10/dist-packages/pyboolnet/external/potassco.py in potassco_handle(primes, type_, bounds, project, max_output, fname_asp, representation, extra_lines) 72 log.info(f"command: {' '.join(cmd_gringo + ['|'] + cmd_clasp)}") 73 ---> 74 raise Exception 75 76 if "ERROR" in error:

Exception:

Samdeman35 avatar May 16 '24 15:05 Samdeman35

ok, can confirm that's a bug, am working on the fix.

hklarner avatar May 16 '24 15:05 hklarner

@jcrozum @mallenjon @Samdeman35 this problem should be fixed now. It seems that the binaries were simply not added to the repo. I have made a bugfix release 3.0.12 that contains the gringo and clasp executables.

I have verified that it works by installing pyboolnet into a fresh venv and running the trap-spaces command for a model from the repo (raf.bnet). The old version 3.0.11 crashed with error

$ pyboolnet trap-spaces raf.bnet 
pyboolnet version: 3.0.11
...
FileNotFoundError: [Errno 2] No such file or directory: './lib/python3.10/site-packages/pyboolnet/binaries/gringo-4.4.0/gringo'

The new version shows correct behaviour:

$ pyboolnet trap-spaces raf.bnet 
pyboolnet version: 3.0.12
001
11-
found 2 trap spaces.

Can anyone confirm it works? To install the latest version call

pip3 install git+https://github.com/hklarner/[email protected]

hklarner avatar May 16 '24 21:05 hklarner

@hklarner just installed version 3.0.12 in a virtual environment where it was not working previously, can confirm that pyboolnet.attractors.compute_attractors is working as intended. thanks for resolving this!

mallenjon avatar May 16 '24 22:05 mallenjon

@hklarner thank you for the quick fix! However, when I try to install the new version using the pip command in Anaconda, the binaries folder is missing, which means I can't import PyBoolNet. I get the following error after running import pyboolnet

FileNotFoundError Traceback (most recent call last) File ~\AppData\Roaming\Python\Python311\site-packages\pyboolnet\helpers.py:52, in read_nusmv_keywords_or_exit() 51 try: ---> 52 return read_nusmv_keywords() 53 except Exception as e:

File ~\AppData\Roaming\Python\Python311\site-packages\pyboolnet\helpers.py:46, in read_nusmv_keywords() 45 fname = os.path.join(ROOT_DIR, "binaries", "nusmvkeywords.json") ---> 46 with open(fname) as fp: 47 return ast.literal_eval(fp.read())

FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\Sam\AppData\Roaming\Python\Python311\site-packages\pyboolnet\binaries\nusmvkeywords.json'

During handling of the above exception, another exception occurred:

Exception Traceback (most recent call last) Cell In[6], line 1 ----> 1 import pyboolnet

File ~\AppData\Roaming\Python\Python311\site-packages\pyboolnet_init_.py:11 8 from pyboolnet.version import read_version_txt 10 VERSION = read_version_txt() ---> 11 NUSMV_KEYWORDS = read_nusmv_keywords_or_exit() 12 COLOR_MAP = {"red1": "#df3e47", "green1": "#4bb93f", "blue1": "#7463b3", "yellow1": "#eecf1a", "pink1": "#db42a6", "green2": "#4cbd38", "red2": "#df3d47", "yellow2": "#efce1a"} 13 COLORS = ["dodgerblue3", "firebrick2", "chartreuse3", "gold1", "aquamarine2", "darkorchid2"]

File ~\AppData\Roaming\Python\Python311\site-packages\pyboolnet\helpers.py:55, in read_nusmv_keywords_or_exit() 53 except Exception as e: 54 log.error(f"could not read NuSMV keywords: exception={e}") ---> 55 raise Exception

Exception:

Samdeman35 avatar May 17 '24 12:05 Samdeman35

However, when I try to install the new version using the pip command in Anaconda, the binaries folder is missing

@Samdeman35 can you check whether this problem is still present in version 3.0.13? If so, please open a new issue "binaries missing in anaconda".

hklarner avatar May 18 '24 09:05 hklarner

Hi @hklarner, thank you for the fix, it works now again in 3.0.13!

Samdeman35 avatar May 21 '24 09:05 Samdeman35