Forums

Pipenv

Is it possible to use Pipenv on Pythonanywhere? I've tried to install it in the console, but get: PermissionError: [Errno 13] Permission denied: '/usr/local/lib/python3.4/dist-packages/pew-1.1.0.dist-info'

should be! https://help.pythonanywhere.com/pages/InstallingNewModules -- let us know if that works.

Thanks Harry! pip install worked but not pip3.6 as per the link.

did you do --user or use a virtualenv? (for --user, you would have to specify pip3.6 etc, but for a virtualenv, because the only python would be say python3.6, then you would just use pip and not pip3.6, and you wouldn't need the --user flag)

I did --user - but I'm still on Python 3.4, maybe that's why?

Also, I'm having some issues - was trying to run a Fabric script via SSH to pipenv install, but it throws the following error:

THESE PACKAGES DO NOT MATCH THE HASHES FROM Pipfile.lock!. If you have updated the package versions, please update the hashes. Otherwise, examine the package contents carefully; someone may have tampered with them.

pillow==3.1.0 from file:///usr/share/pip-wheels/Pillow-3.1.0-cp34-cp34m-linux_x86_64.whl (from -r /tmp/pipenvgtanj8q5-requirement.txt (line 1)):

I assume it's related to the batteries-included packages. What worked for me was manually SSH-ing into the console, running pipenv install <package>. I'm sure there's got to be a better way, but I'm not sure how.

A tangentially related topic - previously virtualenvwrapper's postactivate would export all the environmental variables needed for my deployment script, but I don't think Pipenv has this functionality yet. Is there a way to access the variables I set in /var/www/<example>_wsgi.py?

If you're running stuff from a console, perhaps you could put it in your .bashrc too? There would be duplication of course, but it should work.

I believe pipenv will export enviroment variables it finds in a .env file

Ah thanks @jlgimeno. I completely glossed over that in the pipenv docs. Will try it out.

@Giles, is the install error expected?

The error indicates a mismatch between the hash for a package that pipenv has stored previously and the hash for the package that it's installing now. Whether it is expected depends on where and how you got the original hash.

@glenn am I right that file:///usr/share/pip-wheels/... means it's a batteries included package? If so, wouldn't that mean the batteries included hashes are different from the PyPi ones?

We get those packages from PyPI, so the hash should be the same. Unless it's been changed since we pulled the package last or you're creating your Pipfile on a different platform.

pipenv works like shit on pythonanywhere.com

We are currently testing an update to our virtualisation system that will make pipenv (and a whole lot of other things) works significantly better. If you'd like to try it out, send a request using the feedback system while you'rs logged in to your account.

So just to be clear: right now there is no solution for using pipenv instead of virtualenv at pythonanywhere?

The update glenn mentioned is available. If you want we can turn it on for you. I have not tested whether that will make pipenv work 100% yet.

Thanks for the reply. I already figured out how to move & run my project so no need for that.

OK, glad you got a solution!

Any update on whether the pipenv functionality is working 100% now and whether we need to request it individually or it is already available?

Hi, you still need to request it, we can't guarantee it will work 100%.

how should i activate environment variables when using pipenv?

This Stack Overflow answer looks like a good reference for that.