Import errors caused by diffpy.srmise

38 views
Skip to first unread message

西村真一

unread,
Oct 19, 2015, 10:31:55 AM10/19/15
to diffpy-dev
Dear Diffpy users and developers,

I am a beginner of the Diffpy packages.

I installed the diffpy_cmi-1.0 from the source tarball on a Debian Jessie system.
The installation was successful with no errors in the runtests.

However, installation of the diffpy.srmise-0.5.2 caused a problem.
I could not import any diffpy.* modules except for diffpy.srmise after the installation of diffpy.srmise.
Just removing the "diffpy.srmise-0.5.2-nspkg.pth" file eliminates the import errors.
Thus, I guess the *.pth file for diffpy.srmise changes behaviors of the string "diffpy" and is destructing the path-search process.

Do you have any smart ideas to solve this conflict?

Thank you in advance,
Shinichi Nishimura

Pavol Juhas

unread,
Oct 19, 2015, 11:14:50 AM10/19/15
to DiffPy developers
Hi Shinichi,

pip and easy_install seem to use incompatible ways of setting up
namespace packages such as
diffpy, where subpackages are in different directories. One way out
is to reinstall diffpy.srmise with
pip using the "--egg" option or to use easy_install instead of pip:

(1) first method

pip uninstall diffpy.srmise
pip install --egg diffpy.srmise

(2) second method

pip uninstall diffpy.srmise
easy_install diffpy.srmise

I will check if there is some way of making both pip and easy_install
work, but for now please use the above.
Let me know if there are still problems.

Hope this helps,

Pavol


--
Dr. Pavol Juhas
Condensed Matter Physics and Materials Science Department
Brookhaven National Laboratory
P.O. Box 5000
Upton, NY 11973-5000

西村真一

unread,
Oct 19, 2015, 9:05:14 PM10/19/15
to diffpy-dev
Dear Dr. Juhas,

Thank you for your quick responce.

Your suggestions work fine !
Namespace management of python packages was somewhat tricky for me...
I will use the easy_install for diffpy related packages. (The pip did not work for diffpy.pdfgui and diffpy.pdffit2.)

Thanks again,
Shinichi Nishimura

Pavol Juhas

unread,
Oct 20, 2015, 12:23:43 PM10/20/15
to DiffPy developers
Hi Schinichi,

After exploring a bit more it boils down to this - the diffpy packages need to be either all installed with pip or all with easy_install.  Using "pip install --egg" is quite similar to 
easy_install, so it again does not play well with diffpy packages installed with a bare "pip".

This pip / easy_install incompatibility in handling namespace packages should go away
once we upgrade everything to Python 3, which has a better builtin support for namespace packages.

Best,

Luke Granlund

unread,
Oct 20, 2015, 12:24:36 PM10/20/15
to diffpy-dev
Pavol has definitely provided the preferred options for users at this point in the long-standing history of Python packaging issues, and I'd like to thank him for his rapid help.

For future users, I'll add that diffpy.srmise is a lightweight pure Python package that will happily run as long as it exists in some directory Python can find, so it is almost certainly easier to adjust than the necessarily more complex setup of DiffPy-CMI.  Setting up diffpy.srmise using "python setup.py install" (essentially equivalent to "pip install --egg diffpy.srmise") or "python setup.py develop" from an unzipped source archive should also avoid pip/easy_install namespace issues.

西村真一

unread,
Oct 21, 2015, 6:33:42 AM10/21/15
to diffpy-dev
Dear Pavol,

Thank you for further explanations.

I understand that the "--egg" option is necessary for installing all diffpy packages with pip
to keep the namespace safety of Python2.
Now I can use all the public diffpy packages with the aid of both pip and easy_install.

I hope this great package aggregation will have unified and integrated package management scheme in future,
whereas I know that developing specific modules is more important currently.

Many thanks for your kind help.

Sincerely,
Shinichi Nishimura
Reply all
Reply to author
Forward
0 new messages