Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution for InterpreterNotFound errors from tox #4650

Merged
merged 1 commit into from
Apr 27, 2022
Merged

Solution for InterpreterNotFound errors from tox #4650

merged 1 commit into from
Apr 27, 2022

Conversation

samredai
Copy link
Collaborator

@samredai samredai commented Apr 27, 2022

It's expected that developers won't conveniently have python 3.7, 3.8 and 3.9 installed for tox to use for tests so I've added a recommendation to use pyenv to the python README. This is what I do locally and it works nicely. The content here is definitely more for the CONTRIBUTING.md file but I think it's ok here in the readme during the refactoring.

If anyone else feels there's a better local setup to recommend, let me know!

@samredai
Copy link
Collaborator Author

```
pyenv install 3.7.12
pyenv install 3.8.12
pyenv install 3.9.10
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Wondering if versioning needs to be strict up to patch level? or just 3.8.* should suffice?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do think it would be ok to do without the strict patch level.

That said, since we do test against these specific patch versions, I also don't see a problem with setting it. We'll probably want to keep this up to date though.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed. It would definitely be safe to just install the latest patch version but unfortunately pyenv doesn't allow excluding it such as 3.8 or 3.8.*. They explain some of the rationale in this issue.

One bug (I think?) in pyenv is that if you have multiple versions inside the python-version file, it doesn't know how to pick them all up when you run the shorthand pyenv install command. It's interesting though because pyenv creates that file on its own.

To be clear about what I mean, if you run pyenv local 3.9.10 it will create a .python-version file that looks like this:

3.9.10

and then someone else can come along and just run pyenv install in that directory and it will install 3.9.10.

However, if you do pyenv local 3.7.12 3.8.12 3.9.10, it creates a .python-version file that looks like ours:

3.7.12
3.8.12
3.9.10

but running pyenv install doesn't work:

$ pyenv install
python-build: definition not found: 3.7.12
3.8.12
3.9.10

The following versions contain `3.7.12
3.8.12
3.9.10' in the name:
  3.7.12
  3.8.12
  3.9.10

See all available versions with `pyenv install --list'.

If the version you need is missing, try upgrading pyenv:

  brew update && brew upgrade pyenv

If it's a simple fix in pyenv-install to get it to iterate and install each version, then it might be worth trying a PR there.

Copy link
Contributor

@dramaticlly dramaticlly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you Sam, I did try your suggestion and it helps!

earlier I was saying my pyenv cannot find the 3.9.10 but after brew update pyenv it works

Once all three versions are installed, you can set an application-specific pyenv environment by running the following in the python directory.
```
pyenv local 3.7.12 3.8.12 3.9.10
```
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, I am thinking maybe move tox after pyenv setup will be a good way to validate :)

@rdblue rdblue merged commit 216a085 into apache:master Apr 27, 2022
@rdblue
Copy link
Contributor

rdblue commented Apr 27, 2022

Thanks @samredai!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants