odlgroup / odl

Operator Discretization Library https://odlgroup.github.io/odl/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Problem with absolute paths and version

adler-j opened this issue · comments

On e.g. colab and kaggle I get the following error when importing ODL:

FileNotFoundError                         Traceback (most recent call last)
<ipython-input-1-3c183d1a930c> in <module>()
      1 get_ipython().system('pip install https://github.com/odlgroup/odl/archive/master.zip')
      2 
----> 3 import odl

/usr/local/lib/python3.6/dist-packages/odl/__init__.py in <module>()
     38 curdir = path.abspath(path.dirname(__file__))
     39 
---> 40 with open(path.join(curdir, pardir, 'VERSION')) as version_file:
     41     __version__ = version_file.read().strip()
     42 

FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.6/dist-packages/odl/../VERSION'

This is most likely because we try to access VERSION in an absolute manner rather than a relative manner.

See this example: https://colab.research.google.com/drive/1BIJa3e-TkI6WOYegLaHhsDOCLkq7weRC

I don't really understand why absolute paths are a problem here, but go ahead and try relative paths.

They could very well block absolute paths since it's running in some pseudo-VM. I'll see what happens.

So it seems like the issue is somehow related to #1497 as well. Did you ever try installing from a zip, e.g.

pip install https://github.com/odlgroup/odl/archive/master.zip

?

No. Maybe we should test that on Travis? Nah, no added value.

BTW, if you have git you can also do pip install git+https://github.com/odlgroup/odl.git or pip install git+https://github.com/odlgroup/odl.git@branch to install from git source directly.

Well, git is not installed by default on e.g. windows so it's not as portable :/