Code Monkey home page Code Monkey logo

Comments (6)

whummer avatar whummer commented on May 22, 2024

Thanks for reporting. Judging from where the error originates (https://github.com/benoit-pierre/python2-subprocess32/blob/master/setup.py#L9), the pip installation code must at some point get into a state where some Python code is executed/interpreted by a Python 3.x runtime.

Why exactly this is the case is relatively difficult to say because it very much depends on your environment. But we can try to dig a little deeper. First of all we need to understand how your terminal session points to either version of python:

which python
ls -la `which python`

It can be useful to search for the location of your installed Python versions. If you have the locate command installed, you can try the following (alternatively, you can use find):

locate bin/python2.
locate bin/python3.

(No need to post the entire output from the command above, but maybe it helps you extract the main installation folders for Python 2.x and 3.x). Maybe you can also post the relevant content of your PATH environment variable (before posting, make sure to obfuscate any parts that could reveal your username etc):

echo $PATH

Also, can you double-check if there is any custom $PATH handling logic in your ~/.profile, ~/.bash_profile, or ~/.bashrc. For instance, if your ~/.bashrc adds python to the system path, then under certain circumstances a process that calls python in a sub-shell might in fact call a python 3.x subprocess. This can happen if the command that runs python executes in a different shell than bash (for instance sh), which means that this shell will miss the (bash-specific) customizations and hence could fall back to Python 3 instead. This is of course pure speculation, but it could in fact be a possible scenario.

Generally speaking, if you want to avoid Python 2.x vs 3.x problems altogether, it would be advisable to maintain only one version (Python 2.x) and delete the other version. This is not always possible or desired, though, and generally you should be able to run both versions side by side on a single system. By investigating the output of the commands posted above, we may be able to drill down to the root cause of the problem. Thanks

from localstack.

whummer avatar whummer commented on May 22, 2024

Edit: I just figured out that this issue might have already been fixed in the subprocess32 library (see this pull request: https://github.com/google/python-subprocess32/pull/13/files), but the code has never been released since then. I will look into using a snapshot version of subprocess32, which should fix your issue. Regardless, it would be interesting to find out why this file was executed by Python 3.x in the first place...

from localstack.

mavidser avatar mavidser commented on May 22, 2024

Thanks. Upon rechecking the versions, the problem turned out to be the python3 virtualenv which I'd installed at some point, causing /usr/local/bin/virtualenv -> /usr/local/opt/python3/bin/pyvenv.

Replacing that with the correct version fixed the issue.

Closing the issue, as I'm not sure if version checks is a part of the setup.

from localstack.

whummer avatar whummer commented on May 22, 2024

Thanks for following up on this issue. We have added a patch in 5f0304d to make sure the installation does not fail in the scenario described above.

from localstack.

popcycle avatar popcycle commented on May 22, 2024

I have the same error pip installing flask-mongoengine under virtual 'venv' for Python 3.x but it installed with no errors under virtual 'env' for Python 2.x

from localstack.

whummer avatar whummer commented on May 22, 2024

@popcycle - is your question related to the LocalStack platform? I'm not aware that we are using flask-mongoengine as a dependency.

from localstack.

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.