DEV Community

Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer

Posted on • Updated on

Using Anaconda On Sublime Text (without installing any package)

Alt text of image

It was always a dream of mine to run python on sublime text. But a greater dream was to run Anaconda on sublime text. Here is how you do it on windows!

First Step: Undertand Sublime Text Build

Sublime text provides build options by default. It's pretty intelligent in the sense that if you install python, it'll try to get the path to the executable.

To inspect how python configures build systems, let us try building a new one

Alt text of image

A new file opens up with some configs

Alt text of image

But let us try saving it so see how and where it saves it

Alt text of image

Now let us open an original build file

Alt text of image

we see that it requires the path to an executable

Second Step: Finding the Anaconda executable

we must find the anaconda executable but not any python.exe . to find that we go to the anaconda command prompt

Alt text of image

and we type the following

Alt text of image

next we go to the folder and find the name of the python executable

Alt text of image

then we build a new package and configure it then save it

Alt text of image

next time we choose in our menu

Alt text of image

then control + b to run

Alt text of image

next we feel the power flowing in our veins ++++++__++

NOTE: This post gets A LOT of traffic. The author would appreciate some hearts if you are at it!

Top comments (5)

Collapse
 
mikechen66 profile image
mikechen66

Thanks for your sharing. My problem is that Anaconda3 is installed as defaulated Just Me, not All Users(in Program\Data) as you mentioned. I know that its dirname of C:\Users\Administrator while adding my path to the environment of Win 10. I can get the path of Anaconda3 by the command 'where conda'. However, I could not use the the following command to get the dirname. Can you figure out how to solve the problem as follows.

import os
os.path.dirname(Anaconda3, file)

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Administrator\Anaconda3\lib\ntpath.py", line 221, in dirname
return split(p)[0]
File "C:\Users\Administrator\Anaconda3\lib\ntpath.py", line 183, in split
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

or

import Anaconda 3, os
path = os.path.dirname(Anaconda3.file)

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Administrator\Anaconda3\lib\ntpath.py", line 221, in dirname
return split(p)[0]
File "C:\Users\Administrator\Anaconda3\lib\ntpath.py", line 183, in split
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType

Thanks for your help in advance.

Mike

Collapse
 
mikechen66 profile image
mikechen66

Sorry, the 'file'included in the parentheses in the first comment should include leading double underscore and rear double underscore. But the dialog box of the dev.to system cut the underscore lines automatically in the first comment.So I have to give you the second comment for reference.

Thanks,

Mike

Collapse
 
abdurrahmaanj profile image
Abdur-Rahmaan Janhangeer

Try brutely searching for all python.exe and try the one in anaconda folders

Collapse
 
nsosorio profile image
Nicole Osorio

Hi, I just wanted to thank you for this guide. I rarely go out of my way to create an account to express my gratitude but this was very helpful. Thanks.

Collapse
 
abdurrahmaanj profile image
Abdur-Rahmaan Janhangeer

No problem. It very very nice to hear as rarely do article authors get feedback ^^