When installing using a pip requirements file, listing both sqlalchemy and sqlalchemy_mptt, the installation fails because when pip runs python setup.py egg_info for the sqlalchemy_mptt package, an exception is raised about sqlalchemy not being found.
This is due to the setup.py file importing __version__ from the package, and thus indirectly trying to import sqlalchemy as well.
In such cases I use the following approach in my setup.py files:
data = Setup.read(os.path.join('sqlalchemy_mptt', '__init__.py'))
__version__ = (re.search(u"__version__\s*=\s*u?'([^']+)'", data).group(1).strip())
(I know some people don't like this approach, but while not that elegant, it is simple enough to work in all cases I had to use it).
When installing using a
pip
requirements file, listing bothsqlalchemy
andsqlalchemy_mptt
, the installation fails because whenpip
runspython setup.py egg_info
for thesqlalchemy_mptt
package, an exception is raised aboutsqlalchemy
not being found.This is due to the
setup.py
file importing__version__
from the package, and thus indirectly trying to importsqlalchemy
as well.In such cases I use the following approach in my
setup.py
files:(I know some people don't like this approach, but while not that elegant, it is simple enough to work in all cases I had to use it).