Help fixing a python package issue

0 views
Skip to first unread message

Guillaume Alleon

unread,
Aug 11, 2017, 4:03:27 PM8/11/17
to conda - Public
Hello

I have started building a package for the LAPTK package (lapkt.org)
I managed to create a package in an appropriate docker container which has benn then pushed on anaconda.

The package is then installed on a new container (a conda list shows the package)
When I try to run a test, I got the following message:

(test) [root@247678d813bb shared]# ./test.py 

Traceback (most recent call last):

  File "./test.py", line 2, in <module>

    from lapkt import *

ImportError: No module named lapkt


How can I debug my issue?

Thanks
Guillaume

Michael Sarahan

unread,
Aug 11, 2017, 4:25:06 PM8/11/17
to Guillaume Alleon, conda - Public
take a look at what's actually in your package.  Download it from anaconda.org, extract the .tar.bz2, and see what's there.  For things to be importable in Linux, they need to be in the folder like

lib/pythonX.Y/site-package/your-package-name

Does that folder exist in your package?  If not, you need to examine your recipe to make sure that it's doing the right stuff (moving files into $PREFIX is the ultimate goal, but there's a lot of ways to do that.)  For python packages, it's often simply

python setup.py install

if setup.py imports the setup function from setuptools, you need

python setup.py install --single-version-externally-managed --record=record.txt

It may be that this last bit is what you really need - without it, you get an egg file, and those don't always work very well with conda.

--
You received this message because you are subscribed to the Google Groups "conda - Public" group.
To unsubscribe from this group and stop receiving emails from it, send an email to conda+un...@continuum.io.
To post to this group, send email to co...@continuum.io.
Visit this group at https://groups.google.com/a/continuum.io/group/conda/.
To view this discussion on the web visit https://groups.google.com/a/continuum.io/d/msgid/conda/4df9a8e0-05f7-4604-84fb-50c752f5f3d3%40continuum.io.
For more options, visit https://groups.google.com/a/continuum.io/d/optout.

tog

unread,
Aug 11, 2017, 4:50:00 PM8/11/17
to Michael Sarahan, conda - Public
Thanks Michael

Actually I build my recipe by mimicking what I found in numpy. Therefore if I download the package & tar tvf it I get the following:

-rwxrwxr-x  0 root   root    28962 Aug 11 20:19 lib/python2.7/site-packages/lapkt/fd/translate.py

-rw-rw-r--  0 root   root        0 Aug 11 20:19 lib/python2.7/site-packages/lapkt/fd/__init__.py

-rwxrwxr-x  0 root   root   578256 Aug 11 20:20 lib/python2.7/site-packages/lapkt/libbfsf.so

...

which seems ok to me.

BTW if I untar the file and cd in lib/python2.7/site-packages/lapkt ... my test executes correctly.

Any other idea?


Michael Sarahan

unread,
Aug 11, 2017, 5:11:19 PM8/11/17
to tog, conda - Public
I think you need an empty __init__.py in the lib/python2.7/site-packages/lapkt/ before that .so will be importable.  Otherwise, python does not treat that folder as a package.
Reply all
Reply to author
Forward
0 new messages