Error while loading globally installed package
See original GitHub issueThe latest version (master branch) of the package tries to create a new directory inside the installed package. If a user does not have write permissions to that directory, this will cause the following error:
Traceback (most recent call last):
File "trainv2.py", line 3, in <module>
from chemprop.args import TrainArgs
File "/opt/conda/lib/python3.6/site-packages/chemprop/__init__.py", line 5, in <module>
import chemprop.web
File "/opt/conda/lib/python3.6/site-packages/chemprop/web/__init__.py", line 1, in <module>
from chemprop.web.run import chemprop_web
File "/opt/conda/lib/python3.6/site-packages/chemprop/web/run.py", line 10, in <module>
from chemprop.web.app import app, db
File "/opt/conda/lib/python3.6/site-packages/chemprop/web/app/__init__.py", line 8, in <module>
os.makedirs(app.config['CHECKPOINT_FOLDER'], exist_ok=True)
File "/opt/conda/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/opt/conda/lib/python3.6/site-packages/chemprop/web/app/web_checkpoints'
I’m happy to create a pull request to fix this, but there are various ways to do this. @swansonk14, what would we your preferred solution? The simplest solution would be to modify https://github.com/chemprop/chemprop/blob/master/chemprop/web/config.py, such that the CHECKPOINT_FOLDER points to a temporary directory or a directory in os.getcwd()
. Alternatively, we could add some options to override default configuration before importing the package (e.g., by setting environment variables).
Side question: is there a good reason why chemprop.web
is imported in the first place? For user who only interact via python API or command line interface, there seems to be no reason to load this subpackage (and create the corresponding checkpoints directory).
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (5 by maintainers)
Oh yeah that’s a great idea, thanks! I just added it in this commit: https://github.com/chemprop/chemprop/commit/fc35354a629c5294d2c14e800b54feedce86272b
Hi @swansonk14. This looks like a great improvement! With a globally installed package and the default settings, the app will still raise the above issue, but there is now an easy way to get rid of the error. Maybe you could replace the above with a more user-friendly error message. For example: