spacemacs
spacemacs copied to clipboard
importmagic freezing Emacs startup
Description :octocat:
After started emacs, it gets frozen on the Spacemacs buffer. I can type <C-g>
to get the initialization to finish.
I look at the *Messages*
buffer and see the lines
[yas] Prepared just-in-time loading of snippets successfully.
Importmagic and/or epc not found. importmagic.el will not be working.
Quit
It appears that importmagic.el
is looking for the importmagic
PyPI package to be installed in the system Python environment. I use virtual environments and keep my system Python installation clean of external packages.
Reproduction guide :beetle:
- Start Emacs
Observed behaviour: :eyes: :broken_heart:
Frozen on startup.
Expected behaviour: :heart: :smile:
Not frozen on startup.
System Info :computer:
- OS: gnu/linux
- Emacs: 25.3.1
- Spacemacs: 0.300.0
- Spacemacs branch: develop (rev. 86ff0eb8)
- Graphic display: t
- Distribution: spacemacs
- Editing style: vim
- Completion: helm
- Layers:
(python react javascript csv clojure dash deft docker emoji evernote github graphviz html ipython-notebook java pandoc python restclient scala shell-scripts search-engine semantic spotify sql tmux yaml helm auto-completion better-defaults emacs-lisp git markdown neotree org
(shell :variables shell-default-shell 'multi-term shell-default-position 'right)
spell-checking syntax-checking version-control)
- System configuration features: XPM JPEG TIFF GIF PNG RSVG IMAGEMAGICK SOUND DBUS GCONF GSETTINGS NOTIFY ACL LIBSELINUX GNUTLS LIBXML2 FREETYPE M17N_FLT LIBOTF XFT ZLIB TOOLKIT_SCROLL_BARS GTK3 X11 MODULES XWIDGETS
I installed importmagic
and epc
in a pyenv environment that is backing one of the Python buffers that is opened on startup, and the messages changed to:
[yas] Prepared just-in-time loading of snippets successfully.
Quit
Shell native completion is disabled, using fallback
[importmagic] Indexed (/path/to/directory/containing/python/file/being/opened)
Parsing spacemacs (LL)...done
Startup still freezes after the
[yas] Prepared just-in-time loading of snippets successfully.
line is displayed.
I deleted all the Python buffers and restarted Emacs, and startup completed without freezing.
I opened a Python file and restarted Emacs, and the freezing happened.
In the Python buffer, I typed , r f
and got the message
epc:net-send: Process epc con 3 not running
Can you try to call:
(require 'pyvenv)
(pyvenv-activate DIRECTORY)
In your dotspacemacs/user-config
directory.
@lukeorland by default, importmagic
does not care about virtual environments at all. Instead, you should rely on external packages to manage that, such as virtualenvwrapper.el
or pyvenv
which are known to work with importmagic
. If you really need to change the python interpreter manually, you can setq
the importmagic-python-interpreter
variable.
What is strange though, is that it's loading importmagic
in the spacemacs buffer, which it should not do. I don't use spacemacs but if the issue persists, please feel free to report upstream.
I had the same error message in Spacemacs:
Importmagic and/or epc not found. importmagic.el will not be working
I followed the steps in https://github.com/proofit404/anaconda-mode/issues/295 and changed 127.0.0.1
to localhost
in the anaconda-mode-host
in anaconda-mode.el and now importmagic is working.
Please forget what I wrote above here. There is no connection. When I start emacs normally and not directly on a .py file, I can access importmagic. When I start emacs directly on a python file it cannot load.
The problem happens to me also.
My python-backend is lsp
.
Importmagic and/or epc not found. importmagic.el will not be working.
I use both pipenv and pyenv. But the importmagic does not care about virtual environments at all.
I'm having this issue as well. I am using the lsp
backend, and I python-pipenv-activate t
set as well. I have a .venv
file in the directory of my python project, and when I open a file it correctly start the language server (which is only in the virtual environment) and activates the venv. However, I still get Importmagic and/or epc not found. importmagic.el will not be working.
whenever the LSP activates, even though I've confirmed that I can import importmagic
and import epc
successfully.
I'm running the develop branch (cloned yesterday).
The problem is not really activate your virtual environment, which has importmagic or epc installed.
- activate your virtual environment in shell and
pip install -U importmagic epc
- open python file in emacs,
, v a
pyven-activate
invokes your real virtual environment.
Or doing this in org-mode.
- pyvenv-activate your real virtual environment.
For my personal example.
#+BEGIN_SRC elisp :results silent
(pyvenv-activate "/home/jimmy/.venvs/quant-6R1YVBAt-/home/jimmy/.pyenv/shims/python")
#+END_SRC
- now virtual environment is ready for you.
#+begin_src python :results output
import sys
print(sys.executable)
#+end_src
#+RESULTS:
: /home/jimmy/.venvs/quant-6R1YVBAt-/home/jimmy/.pyenv/shims/python/bin/python
#+begin_src bash :results output
ls -al /home/jimmy/.venvs/quant-6R1YVBAt-/home/jimmy/.pyenv/shims/python/
#+end_src
#+RESULTS:
: total 28
: drwxr-xr-x 6 jimmy jimmy 4096 May 29 15:10 .
: drwxr-xr-x 3 jimmy jimmy 4096 May 29 15:00 ..
: drwxr-xr-x 3 jimmy jimmy 4096 May 31 14:52 bin
: drwxr-xr-x 2 jimmy jimmy 4096 May 29 15:00 include
: drwxr-xr-x 3 jimmy jimmy 4096 May 29 15:00 lib
: lrwxrwxrwx 1 jimmy jimmy 3 May 29 15:00 lib64 -> lib
: -rw-r--r-- 1 jimmy jimmy 24 May 29 15:00 .project
: drwxr-xr-x 2 jimmy jimmy 4096 May 29 15:10 src
In summary,
-
importmagic
orepc
should be installed in one of yoursite-packages
You can check it bypython -m site
For me it is:/home/jimmy/.venvs/quant-6R1YVBAt-/home/jimmy/.pyenv/shims/python/lib/python3.7/site-packages/importmagic
/home/jimmy/.venvs/quant-6R1YVBAt-/home/jimmy/.pyenv/shims/python/lib/python3.7/site-packages/epc
- correctly
pyvenv activate
your real virtual environment.
After doing pip install importmagic epc I have a strange pop up window opening and distorting my KDE desktop whenever i open a python file in spacemacs????
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Please let us know if this issue is still valid!
I too face this problem. I'm running the anaconda backend, and I've installed importmagic
and epc
to my system python, on OSX yet I still have this problem.
I have Python 3.9 installed via Homebrew (on macOS 10.15.7). Also kept having the same error message even after installing epc
and importmagic
. The message went away when I did pip3 install ipython
.
Might also have a look at the customize variable exec-path
and make sure the directory containing the Python you want is early in the list.
For people that may be redirected to this issue, I have some more to contribute to it. I was facing the same issue, but everything was looking right regarding the environments, etc.
My setup is:
-
lsp
-
pyright
-
pyenv
However, what I noticed after trying to run multiple Python code blocks and closed Emacs that several epc
servers where still running and hanging:
When clicking on one of them I was seeing another error:
Indeed, iPython
was not installed in the virtual environment. A simple:
pip install ipython
reloading Emacs, and the error was gone. The problem was not that importmagic
was not installed, but that it was missing another piece to be installed.