Report this

What is the reason for this report?

How to make virtualenv accessible in the flask applications with gunicorn guide?

Posted on September 14, 2021

I’m trying to follow: https://www.digitalocean.com/community/questions/new?tutorial=how-to-serve-flask-applications-with-gunicorn-and-nginx-on-centos-7

However I can’t seem to setup the virtualenv without using sudo. The problem with that is then I cannot activate the virtualenv as I keep getting permission denied on the activate portion. What do I do?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Heya,

Just came across this answer and decided to write some general guidelines for anyone who comes across this in the future despite the old question.

This problem could be due to lack of permission in your current directory.

Here are a few things you can do to resolve this:

  1. First, check if you have enough permission in your current directory by running the command ls -l. If the user and group are not your’s, then you should change the directory to somewhere you have full access to.
  2. Create the virtual environment in a directory where you have full access. If you’re not sure, you can always create it in your home directory.
  3. Also, make sure that you have the correct and updated version of virtualenv. Depending on your system, you can update it with pip install --upgrade virtualenv.

Remember, it’s always best to avoid using sudo when it’s not necessary as it can lead to permission issues like what you’re experiencing now.

For further details, you can visit the Python setup on CentOS guide on DigitalOcean’s community tutorials.

Hope that this helps!

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.