Open takaakimasaki opened 5 years ago
How did you install MpGlue? Did you build from source (below)?
python setup.py build && python setup.py install
Yes I did install mpglue. But it still returns an error: This is the entire error message I got:
import mpglue as gl
/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pysal/init.py:65: VisibleDeprecationWarning: PySAL's API will be changed on 2018-12-31. The last release made with this API is version 1.14.4. A preview of the next API version is provided in the pysal
2.0 prelease candidate. The API changes and a guide on how to change imports is provided at https://pysal.org/about
), VisibleDeprecationWarning)
Traceback (most recent call last):
File "
The _moving_window
module is a Cython module, so let's see if it compiled properly.
_moving_window.so
under
/Users/takaakimasaki/Dropbox/programming/python/mpglue/mpglue/classification
?.pyx
files when running python setup.py build && python setup.py install
?Yes, I do see all those files. But still says "ModuleNotFoundError: No module named 'mpglue.classification._moving_window'"... Not sure what's driving this error.
Can you uninstall mpglue
, rebuild and install and post the tail of the traceback?
Thank you so much for looking into this. I actually tried to do it on my Windows PC and still got the same error message... Any help you can provide on this would be much appreciated!
Traceback (most recent call last):
File "
Hi, I've the same error when I import mpglue from python shell This is my complete trace:
1) Build and Install https://paste.ofcode.org/r5DYguwXtxU8kRffza3ZaL
2) pip install https://paste.ofcode.org/YmXu7xVdcfms7MJHF79GYx
3) import https://paste.ofcode.org/EyvF7GA9g8FTz3f7hLx2VZ
Thanks, so much!
Also, this is the classification's dir content
Solved! Was my fault unzip mpglue folder at the same point to access the python shell,
import mpglue the .so files were compiled into virtual envoiroment path
Also, I must to install 2 pypi extra, Fiona and shapely
@takaakimasaki where are you importing mpglue
from on your terminal? See below if you are attempting to import from within your mpglue
Git directory.
Looking at the traceback of @vdeluca I can see that the installation was clean. However, in the (3. import) test you were inside the mpglue
Git directory that you pulled. If you pip install
then the package is installed into your environment /site-packages directory. The mpglue
Git directory doesn't have any .pyx extensions compiled. Therefore, if you try to import mpglue
from within the Git directory, Python will first attempt to import the relative package, when the correct installed package is in your /site-packages.
You can check where you environment /site-packages directory is located by importing another package, like:
>>> import numpy as np
>>> print(np.__file__)
To test the installation of mpglue
, cd somewhere like your home directory so that Python cannot see the Git directory.
Here is an example of what I was referring to in the previous comment.
> git clone https://github.com/jgrss/mpglue/
> cd mpglue/
# activate a virtual environment if you have one
> python setup.py build && pip install --upgrade --user .
> cd ~
> python -c "import mpglue"
If you do not cd
outside of the Git directory after building then it won't import the correct package. If, however, you want to use the Git directory as the import, you would need to do something like:
> git clone https://github.com/jgrss/mpglue/
> cd mpglue/
> # activate a virtual environment if you have one
> python setup.py build_ext --inplace
# add this Git directory path to PYTHONPATH
Also, this is the classification's dir content
@vdeluca The above link should be related to the same issue. The import fails because you are missing the compiled files (.so
files) inside the Git directory. If you check the mpglue
/site-packages directory after installation, you should see the .so
files.
I get an error message saying "No module named 'mpglue.classification._moving_window'" when I run "import mpglue import moving_window." I am running it on my Mac (MacOS High Sierra). Any advice you could give on solving this issue would be appreciated.