Using namespace_packages

30 views
Skip to first unread message

Amir Mohammadi

unread,
Mar 8, 2016, 6:33:29 AM3/8/16
to bob-devel
Hi everyone,

Our bob packages are split into several packages while they are all under a logical "bob' package.
To make sure that  things work as intended some changes needed to be applied.
You can read about namespace_packages here.

I have written a script which does this automatically for some of packages (list below). You can see a pull-request example below.
https://github.com/bioidiap/bob.io.base/pull/8

These patches should fix the userwarnings that we see like:
python -c 'import bob.blitz, bob.extension, bob'
/home/amir/miniconda3/envs/bobtest/lib/python2.7/site-packages/bob.extension-2.0.11-py2.7.egg/bob/extension/__init__.py:12: UserWarning: Module bob was already imported from bob/__init__.pyc, but /home/amir/miniconda3/envs/bobtest/lib/python2.7/site-packages/bob.extension-2.0.11-py2.7.egg is being added to sys.path
 
import pkg_resources


Note: if you are maintainer of one of these packages, please verify the pull-requests that I have created and ONLY THEN merge them.

List of packages that pull-requests were created: (if you don't see your package here, make sure you apply a similar patch yourself).
antispoofing.utils
bob.ap
bob.bio.base
bob.bio.face
bob.bio.gmm
bob.bio.spear
bob.bio.video
bob.blitz
bob.core
bob.db.arface
bob.db.atnt
bob.db.atvskeystroke
bob.db.avspoof
bob.db.banca
bob.db.base
bob.db.biosecure
bob.db.biosecurid.face
bob.db.casia_fasd
bob.db.casme2
bob.db.caspeal
bob.db.frgc
bob.db.gbu
bob.db.iris
bob.db.kboc16
bob.db.lfw
bob.db.livdet2013
bob.db.mnist
bob.db.mobio
bob.db.msu_mfsd_mod
bob.db.multipie
bob.db.nist_sre12
bob.db.replay
bob.db.scface
bob.db.utfvp
bob.db.verification.filelist
bob.db.verification.utils
bob.db.voxforge
bob.db.wine
bob.db.xm2vts
bob.db.youtube
bob.extension
bob.io.audio
bob.io.base
bob.io.image
bob.io.matlab
bob.io.video
bob.ip.base
bob.ip.color
bob.ip.draw
bob.ip.facedetect
bob.ip.flandmark
bob.ip.gabor
bob.ip.optflow.hornschunck
bob.ip.optflow.liu
bob.learn.activation
bob.learn.boosting
bob.learn.em
bob.learn.libsvm
bob.learn.linear
bob.learn.mlp
bob.math
bob.measure
bob.sp


Thank you,
Amir

André Anjos

unread,
Mar 8, 2016, 6:36:29 AM3/8/16
to bob-...@googlegroups.com
Hello Amir,

Could you please do the same for the bob.db packages that are on bob.nightlies? Those we need to make sure work fine.

Best, Andre

--
-- You received this message because you are subscribed to the Google Groups bob-devel group. To post to this group, send email to bob-...@googlegroups.com. To unsubscribe from this group, send email to bob-devel+...@googlegroups.com. For more options, visit this group at https://groups.google.com/d/forum/bob-devel or directly the project website at http://idiap.github.com/bob/
---
You received this message because you are subscribed to the Google Groups "bob-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bob-devel+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Dr. André Anjos
Idiap Research Institute
Centre du Parc - rue Marconi 19
CH-1920 Martigny, Suisse
Phone: +41 27 721 7763
Fax: +41 27 721 7712
http://andreanjos.org

Manuel Günther

unread,
Mar 8, 2016, 11:19:29 AM3/8/16
to bob-devel
Amir,

some time ago we have removed exactly these two commands in the setup.py and the __init__.py and replaced them with ``__path__ = extend_path(__path__, __name__).
I thought that we had a good reason for that, though I don't remember the details. Now, you are re-adding, what we had removed. Did you talk to Pavel about that?

Manuel

Pavel Korshunov

unread,
Mar 8, 2016, 11:24:10 AM3/8/16
to bob-...@googlegroups.com
Hi Manuel,

Yes, we talked with Amir, once I noticed the numerous pull requests. The issue was with pkg_resources unable to correctly determine the location of three-layered packages (e.g., one is installed in the system and another is built locally).  He is trying to reproduce the issue we had. 
Best,
-pavel

Manuel Günther

unread,
May 27, 2016, 11:35:27 AM5/27/16
to bob-devel
Hi guys,

yesterday I ran into an issue with the namespaces again. It seems that we have to stick to one solution, either using pkg_resources or extend_path. When you install packages (with pip), where some use extend_path and some pkg_resources, you will run into trouble, so that only the pkg_resources-packages can be imported. Unfortunately, uninstalling the pkg_resources-packages did not help, after doing that I couldn't import any bob package. Luckily I had installed them in a virtual environment, so that I could simply delete that. But people installing Bob packages globally using pip will screw up their operating system for good.

So far, I have seen two packages that are in our bob.nightlies aggregation: bob.db.ijba (which I have fixed yesterday) and bob.db.cuhk_cufs (which seems to require more work, at least the buildout.cfg and requirements.txt are incomplete in that package). I am pretty sure that there are more packages on PyPI, which have the old namespace'ing (using pkg_resources) and which would screw up the installation.
So, please check all the bob packages that you have uploaded to PyPI and correct the namespace'ing if required.

Cheers
Manuel
Reply all
Reply to author
Forward
0 new messages