-
Notifications
You must be signed in to change notification settings - Fork 261
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
ModuleNotFoundError: No module named 'pkg_resources' #1674
Comments
Thanks for reporting, It looks like a missing dependency. |
Should be fixed if you update to the last Elpy version. Please re-open this issue if the problem still exist. |
The problem still exists:
setuptools for python3 is also installed system wide. |
Hum, that is strange,
I found this post on stackoverflow mentionning the same issue. |
I install my python packages system-wide, with
2- restart the emacs Hopefully this helps to identify the bug! |
Thanks for the feedback. I tried to play with |
No, putting the line back to the config file does not cause the error. |
Ok, thanks, |
I have this same issue, installed my emacs config on a new machine and I can't get elpy is work. I keep getting this error while working in Python files;
It hiccups on every other keystroke, which is debilitating. My elpy config is: (use-package elpy
:custom
(elpy-rpc-python-command "python3")
(elpy-modules '(elpy-module-company))
(python-shell-interpreter "ipython3")
(python-shell-interpreter "-i --simple-prompt")
:config
(elpy-enable))
|
The I found a bug that I am trying to fix in PR #1699. |
Great! Installing the latest source seems to work fine. I do run into a separate error upon choosing to install additional packages while running
For now, I've enabled site-wide packages in the virtual environment, but any clarification on this would be appreciated. This environment is a newly-setup Ubuntu 18.04 with the configuration I've given above. |
That's unexpected... pip is supposed to be installed in the rpc venv. |
Sure, with the site-wide packages enabled, I have:
Without that option I have
Again, this is a relatively clean installation, maybe it could be reproduced on a new VM for example? Hope this helps. |
I tried from a clean Emacs installation without success. I suspect a problem with the way Elpy is creating the virtualenv. python3 -m venv /home/chronos/.emacs.d/elpy/rpc-venv What happen if you delete the |
I tried removing the folder and reinstalling, no success. Under |
I checked the
So I am a bit confused why it is not doing it. What happen if you run |
Well, that's the thing, there's no way elpy is creating the virtual environment fully. I can't even activate the virtual environment outside of emacs-- the directory is under-formed: chronos@pc:~/.emacs.d/elpy$ ls -R rpc-venv/
rpc-venv/:
bin elpy-rpc-python-path-command include lib lib64 pyvenv.cfg
rpc-venv/bin:
python python3
rpc-venv/include:
rpc-venv/lib:
python3.6
rpc-venv/lib/python3.6:
site-packages
rpc-venv/lib/python3.6/site-packages: AFAIK, a normal virtual environment would have the |
So if the virtualenv is not created properly you may find some useful information in the " *venv*" (or " *virtualenv*") buffer Elpy creates when using If nothing useful there, maybe the problem comes from the command Elpy uses to create the virtualenv: python3 -m venv /home/chronos/.emacs.d/elpy/rpc-venv Does it creates a viable virtualenv is you run that from the command line ? |
Aha, I think you've found it: chronos@pc:~$ python3 -m venv /home/chronos/.emacs.d/elpy/rpc-venv
The virtual environment was not created successfully because ensurepip is not
available. On Debian/Ubuntu systems, you need to install the python3-venv
package using the following command.
apt-get install python3-venv
You may need to use sudo with that command. After installing the python3-venv
package, recreate your virtual environment.
Failing command: ['/home/chronos/.emacs.d/elpy/rpc-venv/bin/python3', '-Im', 'ensurepip', '--upgrade', '--default-pip'] After running Now running
Which is great! I now only have the issue where the elpy module is not found, but I think that warrants a different issue rather than discussing it in this thread. Thanks again! |
Good to know it works now. Did you by any chance installed Elpy from the Debian package repository ?
Please open a new one if it is giving you headaches :). |
For this setup, I have it installed using |
This problem recurs with Fedora 39. Workaround is to activate the venv in bash, and pip install setuptools. |
@nickurbanik @galaunay
elpy version 20230803.1455 "activate the venv in bash" I don't understand, how do you mean? Elpy output still shows File "", line 88, in _run_code File "~/.emacs.d/elpa/elpy-20230803.1455/elpy/main.py", line 16, in
File "~/.emacs.d/elpa/elpy-20230803.1455/elpy/server.py", line 16, in
File "~/.emacs.d/elpa/elpy-20230803.1455/elpy/blackutil.py", line 33, in
File "~/.emacs.d/elpa/elpy-20230803.1455/elpy/blackutil.py", line 14, in parse_version
elpy.rpc.Fault: |
Maybe >>> from packaging.version import Version
>>> import black
>>> Version(black.__version__)>Version("21.5b1")
True
>>> black.__version__
'23.12.0'
> pip show packaging
Name: packaging
Version: 23.2
Summary: Core utilities for Python packages
Home-page:
Author:
Author-email: Donald Stufft <[email protected]>
License:
Location: /home/hoel/.pyenv/versions/3.12.0/lib/python3.12/site-packages
Requires:
Required-by: black, matplotlib, pyproject-api, pytest, Sphinx, webdriver-manager |
The above has worked thank you very much |
I created a pull request (#2037) to replace |
Summary
Elpy produces the following error when navigating through the source code:
Config:
The text was updated successfully, but these errors were encountered: