question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error while loading globally installed package

See original GitHub issue

The 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:closed
  • Created 3 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
swansonk14commented, Sep 22, 2020

Oh yeah that’s a great idea, thanks! I just added it in this commit: https://github.com/chemprop/chemprop/commit/fc35354a629c5294d2c14e800b54feedce86272b

0reactions
msteijaertcommented, Sep 21, 2020

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:

# Create folders
    if create_folders:
        if not os.access(os.path.dirname(app.config['ROOT_FOLDER']), os.W_OK):
            raise ValueError("You do not have write permissions on the root_folder. Please specify a different root_folder while starting the web app.")
        for folder_name in ['ROOT_FOLDER', 'DATA_FOLDER', 'CHECKPOINT_FOLDER', 'TEMP_FOLDER']:
            os.makedirs(app.config[folder_name], exist_ok=True)
Read more comments on GitHub >

github_iconTop Results From Across the Web

globally installed npm-packages not working - node.js
The NODE_PATH should contain the location of directories where the modules are installed. It can have multiple directories (colon seperated).
Read more >
Can not run globally installed packages which are ... - GitHub
I can not run globally installed packages (uglifyjs, eslint etc). Looks like there are problems with path. When I run (you full steps...
Read more >
npm -g install <npm_package>not working as desired. Why ...
The problem can be with your global npm installation of the package. While all things are working just fine with running local project...
Read more >
Resolving EACCES permissions errors when installing ...
If you see an EACCES error when you try to install a package globally, you can either: Reinstall npm with a node version...
Read more >
Fix Global Installs Not Working | "Cannot find module" error FIX
Getting " Cannot find module" after installing something globally ( with -g)? Well, this video shows you how to fix global package /module ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found