I have installed CLIPSpy from the git repository, and followed the instructions for installing with the source files. Yet after installing and running the python shell I get this error:
`import clips
.../clipspy/clips/__init__.py", line 30, in <module>
from clips.error import CLIPSError
.../clipspy/clips/error.py", line 32, in <module>
from clips.router import Router
.../clipspy/clips/router.py", line 7, in <module>
from clips._clips import lib, ffi
ModuleNotFoundError: No module named 'clips._clips'`
Despite this error, if I run the same commands outside of my CLIPSpy directory, I can import clips but get a different error.
>>> import clips
>>> env = clips.Environment()
>>> env.assert_string("(test 12)")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Environment' object has no attribute 'assert_string'
My assumption is that ModuleNotFoundError may be responsible for the AttributeError.
OS: Arch Linux
git-repo: https://github.com/noxdafox/clipspy
I followed the advice of specifying the directory of clips, using pyclips and import clips as a python module, to specify the location of clips but it still gives me the same error.
Installing CLIPSpy via pip gave 'satisfactory' results: ModuleNotFoundError: No module named 'pygame'
Requirement already satisfied: clipspy in /usr/lib/python3.7/site-packages/clipspy-0.3.2_2_g7dd9ca2-py3.7-linux-x86_64.egg (0.3.2-2-g7dd9ca2)
Requirement already satisfied: cffi>=1.0.0 in /usr/lib/python3.7/site-packages (from clipspy) (1.12.2)
Requirement already satisfied: pycparser in /usr/lib/python3.7/site-packages (from cffi>=1.0.0->clipspy) (2.19)
I tried re-installing clipspy via github many times, but the same issue persists. The interesting part is that I used pyclips as alternative for a while and it gave me the same error. It might be something to do with the directory or the installation, but I am not sure what it could be.
The installation process for CLIPSpy was as follows:
make:
python setup.py build_ext --include-dirs clips_source \
--library-dirs clips_source
/usr/lib/python3.7/site-packages/setuptools/dist.py:484: UserWarning: The version specified ('0.3.2-2-g7dd9ca2') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
"details." % self.metadata.version
running build_ext
generating cffi module 'build/temp.linux-x86_64-3.7/_clips.c'
already up-to-date
I tried re-installing setuptools to see if I could get a valid dist.py version, but alas nothing has changed.
sudo make install:
....
Installed /usr/lib/python3.7/site-packages/clipspy-0.3.2_2_g7dd9ca2-py3.7-linux-x86_64.egg
Processing dependencies for clipspy===0.3.2-2-g7dd9ca2
Searching for cffi==1.12.2
Best match: cffi 1.12.2
Adding cffi 1.12.2 to easy-install.pth file
Using /usr/lib/python3.7/site-packages
Searching for pycparser==2.19
Best match: pycparser 2.19
Adding pycparser 2.19 to easy-install.pth file
Using /usr/lib/python3.7/site-packages
Finished processing dependencies for clipspy===0.3.2-2-g7dd9ca2
The solution could be something simple, but I can't seem to know what it is.
Any help or advice on what to do or where I went wrong would be greatly appreciated.
EDIT 1: After removing files related to clips, and having a fresh install, I no longer receive the Atribute Error. Rather I get an ImportError
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.7/site-packages/clipspy-0.3.1-py3.7-linux-x86_64.egg/clips/__init.py", line 30, in <module> from clips.error import CLIPSError
File "/usr/lib/python3.7/site-packages/clipspy-0.3.1-py3.7-linux-x86_64.egg/clips/error.py", line 32, in <module> from clips.router import Router
File "/usr/lib/python3.7/site-packages/clipspy-0.3.1-py3.7-linux-x86_64.egg/clips/router.py", line 7, in <module> from clips._clips import lib ffi
Import Error: libclips.so: cannot open shared object file: No such file or directory
I've cloned the git repository that contains tag 3.2
EDIT 2: Managed to fix the error by renaming the libclips.so.6 file located in the /usr/lib/ folder to libclips.so Now it works.
I am the author of the clipspy
module. I would rather suggest you to open a GitHub issue for these types of matters rather than a SO question.
As a general line, the issues you are suffering from indicate you are trying to install a Python module in a dirty environment. For example, installing via pip
resolves in a noop because you ran make install
beforehand and pip
sees the package is already installed.
To install from git, you either git clone a specific tag or download the code from a specific release. clipspy
uses tags to infer the version numbers hence you see the warning:
UserWarning: The version specified ('0.3.2-2-g7dd9ca2') is an invalid version, this may not work as expected with newer versions of setuptools, pip, and PyPI. Please see PEP 440 for more details.
A common issue when installing clipspy
is an old version of setuptools
. Have you tried updating it to a more recent version?
# pip install --upgrade setuptools
One last note, do you happen to also have PyCLIPS installed within the system? The namespaces will conflict as the modules are both called clips
. This would explain the error traceback:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'Environment' object has no attribute 'assert_string'