tiangolo / uwsgi-nginx-flask-docker

Docker image with uWSGI and Nginx for Flask applications in Python running in a single container.
https://hub.docker.com/r/tiangolo/uwsgi-nginx-flask/
Apache License 2.0
2.98k stars 608 forks source link

Cannot find Python module with Conda #53

Closed TamanKaax closed 4 years ago

TamanKaax commented 6 years ago

Hi, First of all, thanks for the great work! I adapted the image by installing conda on top of it. I need conda to install the fast.ai library and all its dependencies. I do this on the base conda env.

When i try to run the container, it cannot find the fastai library. However, when i run the container interactively, it runs the flask app without any issues. hence the Flask development webserver can find the fastai library but nginx/uwsgi/supervisor cannot.

Any idea how to solve this issue? What files / settings need to be adapted?

Thanks! Francis

tiangolo commented 6 years ago

I think you are probably having 2 Python environments. One that comes with this image and one with conda that you use to install fast.ai.

I think you could try installing uwsgi with conda, or at least with the pip in your conda installation, and then modify the supervisord.conf to use the path of the new uwsgi from your conda environment.

cameroncruz commented 6 years ago

I encountered a similar issue and had to create a modified supervisord.conf as per @tiangolo 's reply. For future readers, this repo shows how to properly use miniconda on top of uwsgi-nginx-flask:python3.6 without environment conflicts: https://github.com/cameroncruz/flask-nginx-uwsgi-miniconda

tiangolo commented 6 years ago

Thanks for the info @cameroncruz ! :+1:

KingDarBoja commented 4 years ago

I encountered a similar issue and had to create a modified supervisord.conf as per @tiangolo 's reply. For future readers, this repo shows how to properly use miniconda on top of uwsgi-nginx-flask:python3.6 without environment conflicts: https://github.com/cameroncruz/flask-nginx-uwsgi-miniconda

Just to point out, the following command is deprecated on latest version of miniconda3 (using 4.7.12.1): conda build purge-all

The warning prompt suggest: conda build purge-all

Cheers!

tiangolo commented 4 years ago

Thanks for the note @KingDarBoja !

KingDarBoja commented 4 years ago

I just noticed the warning prompt was the same as the deprecation notice, I think it should be conda build purge but can't remember right now.

Anyway, glad to help 🚀

tiangolo commented 4 years ago

Great!

@TamanKaax if your question is solved, you can close the issue.

github-actions[bot] commented 4 years ago

Assuming the original issue was solved, it will be automatically closed now. But feel free to add more comments or create new issues.