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

Fix error in Conda environments that use Python 3.10 #16

Merged
merged 1 commit into from
Jun 12, 2023

Conversation

ccordoba12
Copy link
Contributor

@ccordoba12 ccordoba12 commented Jun 11, 2023

First of all, thanks for this great package! We're using it in Spyder to easily run Pylint in any virtual or conda environment.

This PR will solve an error discovered by our users in Python 3.10 conda envs for Posix systems. It seems in that case conda automatically creates a symlink called python3.1, which points to the python3.10 directory. To avoid it, I resolved all symlinks for Python directories found by pylint_env and discarded the repeated ones.

Copy link
Owner

@jgosmann jgosmann left a comment

Choose a reason for hiding this comment

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

Thanks! I find it weird that a python3.1 symlink is created and think that this might be a bug in conda. Nevertheless, I think it makes sense to resolve symlinks in pylint-venv.

@@ -94,7 +98,7 @@ def activate_venv(venv):
raise IncompatibleVenvError(
f"The virtual environment {venv!r} has multiple lib/pythonX.Y directories."
)
site_packages = os.path.join(lib_dir, python_dirs[0], "site-packages")
site_packages = os.path.join(list(python_dirs)[0], "site-packages")
Copy link
Owner

Choose a reason for hiding this comment

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

non-critical/very minor:

Suggested change
site_packages = os.path.join(list(python_dirs)[0], "site-packages")
site_packages = os.path.join(next(python_dirs), "site-packages")

might be slightly more efficient as it avoids creating a new list.

@jgosmann jgosmann merged commit 1936ed6 into jgosmann:main Jun 12, 2023
@jgosmann
Copy link
Owner

Released as version 3.0.2.

@ccordoba12 ccordoba12 deleted the fix-conda-symlink-error branch June 12, 2023 16:06
@ccordoba12
Copy link
Contributor Author

@jgosmann, thanks for the quick review and releasing a new version for pylint_env!

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

Successfully merging this pull request may close these issues.

2 participants