SublimeREPL
SublimeREPL copied to clipboard
Anaconda Python environment not activated when running from SublimeText3 SublimeREPL package
I am using SublimeText3 with the SublimeREPL package and the Miniconda python installation. I have followed the instructions listed here to run python from SublimeText3 with a custom environment:
https://stackoverflow.com/questions/20861176/how-do-i-setup-sublimerepl-with-anacondas-interpreter
Yet, when I run the Python interpreter from SublimeText3, I initially get
Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Warning:
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
If I then try to
import numpy
I get the following error message:
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\USER\Miniconda3\envs\CUSTOM_ENV\lib\site-packages\numpy\__init__.py", line 140, in <module>
from . import _distributor_init
File "C:\Users\USER\Miniconda3\envs\CUSTOM_ENV\lib\site-packages\numpy\_distributor_init.py", line 34, in <module>
from . import _mklinit
ImportError: DLL load failed: The specified module could not be found.
For other packages such as sympy, I don't get an error when I try to import the package.
Similarly, if I run anaconda from the anaconda prompt and import numpy, it runs without errors.
So it seems that it is calling python from the custom environment but thinks the environment isn't activated and can't load Numpy.
Post is cross-posted here:
https://stackoverflow.com/questions/56713189/anaconda-python-environment-not-activated-when-running-from-sublimetext3-sublime
I also encounter the same problem.
I use R from conda
, but this should work for other REPLs too. Copy this into user settings of SublimeREPL:
{
"default_extend_env": {"PATH": "/home/jena/miniconda3/bin:{PATH}"}
}
Obviously tweak the path to correspond to your installation :wink:
Edit: I myself used the second answer from your link, long time ago. Tried this on many linux machines, works every time.