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.

Container runs Python 2.7 instead of Python 3.6

See original GitHub issue

i have an app structured as follow:

app
    app
       main.py
    Dockerfile
    uwsgi.ini
docker-compose.yml

Dockerfile:

FROM tiangolo/uwsgi-nginx-flask:python3.6
RUN pip3 install gensim pymongo pandas numpy

docker-compose.yml:

version: '2'
services:
  s_a:
    build: ./app
    links:
      - s_db
    volumes:
      - ./app/app:/app
    ports:
      - "8080:80"
    
  s_db:
    image: mongo
    ports:
      - "27370:27017"
    volumes:
      - ./app/mongodb:/data/db

uwsgi.ini:

[uwsgi]
module = app.main
callable = app

master = true
processes = 10

when up docker-compose.yml i get the error: error

I don’t know why the runs on Python 2.7 instead of Python 3.6. Where is the problem ?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
tiangolocommented, Sep 28, 2018

I just tried replicating your environment. But I didn’t get your error. I got a different one.

I had to move the file uwsgi.ini from ./app/uwsgi.ini to ./app/app/uwsgi.ini because that’s the directory that you are mounting.

I had to change its contents to:

[uwsgi]
module = main
callable = app

master = true
processes = 10

And then it ran without problems.


Now some development suggestions:

  • Don’t mount your code as a volume for production, only for development.
  • So, your Dockerfile should have a COPY directive copying your code.
  • For development, you can mount your code with a docker-compose.override.yml that doesn’t affect your final docker-compose.yml.

You can create a public repo with your actual code and the steps to replicate the issue, that way I can take a look.

You can use the example template project as a base or a guidance to compare with what you have and see what you have to change. It includes the docker-compose.yml files.

0reactions
tiangolocommented, Oct 12, 2018

Does this issue related to the naming?

Actually, I don’t know, I don’t really know what was wrong and what was producing the error.

But I’m glad you solved it.

Should we close this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Run Python Versions in Docker: How to Try the Latest Python ...
In this tutorial, you'll learn how to run different Python versions in Docker. By following the examples, you'll see how you can play...
Read more >
Force RStudio to use Python 3.6 and not Python 2.7
How to force RStudio to use default system Python version (3.6 in my case) instead of 2.7? Default version of Python: username@usernameVB:~$ ...
Read more >
Docker Says New Python Version Required
Running Docker version 20.10.1, build 831ebea on Linux Mint 20 Ulyana. ... python:3.6.9 and then tried to install fastparquet==0.3.2 there.
Read more >
What's New In Python 3.8 — Python 3.11.1 documentation
They also re-appear in the box for the next customized run. One can also suppress the normal Shell main module restart. (Contributed by...
Read more >
What's New In Python 3.9 — Python 3.11.1 documentation
Python 3.9 is the last version providing those Python 2 backward compatibility layers, ... Python 3.9 uses a new parser, based on PEG...
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