Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when importing PySwip #76

Open
ThePinger opened this issue Dec 23, 2019 · 6 comments
Open

Error when importing PySwip #76

ThePinger opened this issue Dec 23, 2019 · 6 comments

Comments

@ThePinger
Copy link

I get this error whenever I try to run from pyswip import Prolog

>>> from pyswip import Prolog
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyswip/__init__.py", line 29, in <module>
    from pyswip.prolog import Prolog
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyswip/prolog.py", line 28, in <module>
    from pyswip.core import *
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyswip/core.py", line 568, in <module>
    (_path, SWI_HOME_DIR) = _findSwipl()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyswip/core.py", line 417, in _findSwipl
    (path, swiHome) = _findSwiplDar()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyswip/core.py", line 371, in _findSwiplDar
    (path, swiHome) = _findSwiplFromExec()
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyswip/core.py", line 93, in _findSwiplFromExec
    rtvars = dict((name, value[1:-1]) for name, value in ret) # [1:-1] gets
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pyswip/core.py", line 93, in <genexpr>
    rtvars = dict((name, value[1:-1]) for name, value in ret) # [1:-1] gets
ValueError: not enough values to unpack (expected 2, got 1)

I use Prolog 7.6.4
Python 3.8
and macOS

@saraswat
Copy link

I face the same problem but with swipl 8.0.3, python 3.8 macOS Mojave (10.14.6).
So pyswip is unusable for me at this point :-(.

@ThePinger
Copy link
Author

I actually solved this problem, So first of all I had to use swipl 7.6.4 as that's the one that will work with macOS Mojave so you should downgrade to the 7.6.4 version and then try running the following commands:

  • export PATH=$PATH:/Applications/SWI-Prolog.app/Contents/swipl/bin/x86_64-darwin15.6.0
  • export DYLD_FALLBACK_LIBRARY_PATH=/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0

I actually don't remember if that's all I needed for it to get working or not but I'm pretty sure that these steps helped. So if that didn't work tell me so I can remember what other steps needed.

@steven-tey
Copy link

What worked for me was that I had to import swi-prolog using Homebrew as explained in this article: https://www.swi-prolog.org/build/macos.html

I was able to figure this out by reading the _findSwiplFromExec() function in the core.py file and turns out this error was because swi-prolog was not installed on my local system

@jBidya
Copy link

jBidya commented Nov 3, 2021

I actually solved this problem, So first of all I had to use swipl 7.6.4 as that's the one that will work with macOS Mojave so you should downgrade to the 7.6.4 version and then try running the following commands:

  • export PATH=$PATH:/Applications/SWI-Prolog.app/Contents/swipl/bin/x86_64-darwin15.6.0
  • export DYLD_FALLBACK_LIBRARY_PATH=/Applications/SWI-Prolog.app/Contents/swipl/lib/x86_64-darwin15.6.0

I actually don't remember if that's all I needed for it to get working or not but I'm pretty sure that these steps helped. So if that didn't work tell me so I can remember what other steps needed.

How to this the problem, i tried the solution you wrote but its not working.

@HEmile
Copy link

HEmile commented Jan 13, 2022

What worked for me was that I had to import swi-prolog using Homebrew as explained in this article: https://www.swi-prolog.org/build/macos.html

I was able to figure this out by reading the _findSwiplFromExec() function in the core.py file and turns out this error was because swi-prolog was not installed on my local system

This fixed it for me. Maybe the INSTALL README should reflect that this is the best way to install SWIPL on Mac?

@ghost
Copy link

ghost commented Feb 27, 2023

I am having the same issues as described above, I am struggling with trying to solve the issue and my tutors at University don't seem to know how to use it! I am using swi-prolog 9 and pyswip in my project, any help would be much appreciated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants