I have a Windows 10 machine, with the official GNU emacs Windows build, and Anaconda Python 3.7.3. I can't get Python to properly run within emacs. Whenever I start Python, I get the message:

Python 3.7.3 (default, Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32

This Python interpreter is in a conda environment, but the environment has not been activated.  Libraries may fail to load.  To activate this environment please see https://conda.io/activation

Type "help", "copyright", "credits" or "license" for more information.

And numpy, scipy, etc won't load. I have tried several things with the pyvenv and elpy packages, all to no avail. From a DOS prompt, I type 'activate' to activate the conda env. I haven't setup any venv's of my own.


Provided that you added the paths to your conda install in Windows' environment variables [*], the following should work :

  1. M-x shell in Emacs

  2. In the shell, run conda activate base. This will load the environment and allow you to use the libraries (like numpy).

  3. In the same shell, run python -i (or ipython -i). The -i forces a prompt. Without it, the shell hangs in Windows, I don't know why.

[*] Windows -> Environment variables -> System Variables -> Path -> Edit. The paths should look like this (check them beforehand !) : C:\Users\YOUR_USER_NAME\AppData\Local\Continuum\anaconda3\Scripts and C:\Users\YOUR_USER_NAME\AppData\Local\Continuum\anaconda3. You'll have to relaunch the shell (and Emacs !) for the environment variables to be taken into account.


This solved my issue of numpy failing to load on import when using Anaconda3/python on Windows 10 from my Emacs session:


  • 1
    Welcome to emacs.SE! Please avoid providing link-only answers. Try to summarize how the issue is solved, this is will make it potentially much more usefull in the future. – JeanPierre Oct 7 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.