Coder Social home page Coder Social logo

No guarantee that Dockerfile and piplock will be compatible, leading to error installing psychopg2 about djangoforprofessionals HOT 3 CLOSED

wsvincent avatar wsvincent commented on July 18, 2024
No guarantee that Dockerfile and piplock will be compatible, leading to error installing psychopg2

from djangoforprofessionals.

Comments (3)

wsvincent avatar wsvincent commented on July 18, 2024 2

Yes, I think you are correct. I've updated the newer versions of the book to use Python 3.8 but this is a very likely gotcha for newcomers. Thank you for pointing it out. I like your idea of using the requires feature; I think I'll use that in the new text!

from djangoforprofessionals.

lapulgaatomica avatar lapulgaatomica commented on July 18, 2024

I ran into an error, which I've fixed, but that could be a trap for new users. It stems from having a system install of python 3.8, and the book (sample at least) relying on python 3.7. Admittedly your prior book does have extensive and useful dev environment set-up instructions, but not this one.

I have python 3.8 installed on my system as the user default. Therefore, the piplock file will default to:

[requires]
python_version = "3.8"

When you get to install the psycopg2 package, the error that is thrown is:

❯ docker-compose exec web pipenv install psycopg2-binary==2.8.3
Warning: Python 3.8 was not found on your system…
Neither 'pyenv' nor 'asdf' could be found to install Python.
You can specify specific versions of Python with:
$ pipenv --python path/to/python

I believe the error arises from how the Dockerfile and the piplock at this point differ, with the Dockerfile specifying 3.7. If the piplock gets changed manually to 3.7 however, then the install runs as expected.

A potential guarantee may be adding the --python 3.7 on pipenv creation.

I'm not sure what you mean by "adding --python 3.7 on pipenv creation" can you please explain?

from djangoforprofessionals.

DaveParr avatar DaveParr commented on July 18, 2024

@lapulgaatomica pipenv is a way of managing environments and dependencies for python.

https://pypi.org/project/pipenv/

In this particular case, and from memory now almost a year back @wsvincent in his (great) books, I think introduces people following through the work on their computers in a way that encourages them to use pipenv to set up their projects. In this case I was making a (soft) recommendation that for future copies of the book he includes the instruction to run pipenv --python 3.7 as this will set the project up in a way that, at the time, fixed a dependcy issue with psychopog2.

If you go the website listed above and look at the usage section on the front page it says:

"Usage Examples:
Create a new project using Python 3.7, specifically:
$ pipenv --python 3.7"

this is what I was referring to.

Hope that helps :)

from djangoforprofessionals.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.