mandeep / sublime-text-conda

Work with conda environments in Sublime Text 3
BSD 3-Clause "New" or "Revised" License
26 stars 10 forks source link

PermissionError: [WinError 5] Access is denied #20

Closed damonbla closed 4 years ago

damonbla commented 4 years ago

Hi, I'm running this with Sublime Text 3. I have the package installed and I can see Conda as one of my build options. Everything is basically at the defaults. When I try to build even a very simple python script, I get this in the console:

Traceback (most recent call last): File "C:\Program Files\Sublime Text 3\sublimeplugin.py", line 1050, in run return self.run(**args) File "C:\Users\damon\AppData\Roaming\Sublime Text 3\Installed Packages\Conda.sublime-package\commands.py", line 526, in run File "C:\Users\damon\AppData\Roaming\Sublime Text 3\Installed Packages\Conda.sublime-package\commands.py", line 489, in enter File "C:\Users\damon\AppData\Roaming\Sublime Text 3\Installed Packages\Conda.sublime-package\commands.py", line 473, in conda_version File "./python3.3/subprocess.py", line 576, in check_output File "./python3.3/subprocess.py", line 819, in init File "./python3.3/subprocess.py", line 1110, in _execute_child PermissionError: [WinError 5] Access is denied

This also happens when I run Sublime Text as an Administrator. Here's the output from "conda info" in an Anaconda Prompt:

     active environment : base
    active env location : C:\Users\damon\anaconda3
            shell level : 1
       user config file : C:\Users\damon\.condarc
 populated config files : C:\Users\damon\.condarc
          conda version : 4.8.3
    conda-build version : 3.15.1
         python version : 3.6.10.final.0
       virtual packages : __cuda=11.0
       base environment : C:\Users\damon\anaconda3  (writable)
           channel URLs : https://repo.anaconda.com/pkgs/main/win-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/win-64
                          https://repo.anaconda.com/pkgs/r/noarch
                          https://repo.anaconda.com/pkgs/msys2/win-64
                          https://repo.anaconda.com/pkgs/msys2/noarch
          package cache : C:\Users\damon\anaconda3\pkgs
                          C:\Users\damon\.conda\pkgs
                          C:\Users\damon\AppData\Local\conda\conda\pkgs
       envs directories : C:\Users\damon\anaconda3\envs
                          C:\Users\damon\.conda\envs
                          C:\Users\damon\AppData\Local\conda\conda\envs
               platform : win-64
             user-agent : conda/4.8.3 requests/2.23.0 CPython/3.6.10 Windows/10 Windows/10.0.17763
          administrator : False
             netrc file : None
           offline mode : False

Please, I'd love to use this so I can have Sublime Text as my IDE. Spyder is killing me slowly day after day.

mandeep commented 4 years ago

Hi @damonbla thanks for the error report. Can you show me what your Conda.sublime-settings file looks like?

damonbla commented 4 years ago

Sure! I changed them so they weren't relative in hopes of solving the problem, but it didn't fix it.

// Default settings for sublime-text-conda:
{
    // executable is the path to anaconda's python
    // this python executable is used in order to find conda
    "executable": "C:\\Users\\damon\\anaconda3",

    // Directory in which the conda envs are stored
    // Default location is the user's home directory
    "environment_directory": "C:\\Users\\damon\\anaconda3\\envs",

    // configuration is the path to conda's configuration file
    "configuration": "C:\\Users\\damon\\.condarc",

    // when true, the scripts will be run through the shell
    // If your code has a GUI (e.g. a matplotlib plot),
    // this needs to be true, otherwise Windows suppresses it.
    "run_through_shell": true,

    // when true, the script execution will be handed over to
    // the pythonw executable, instead of python
    "use_pythonw": false,

}
mandeep commented 4 years ago

It looks like your executable line is pointing to a directory instead of a binary. You want to point it to the actual python3 binary within the directory. On Windows I think this would be C:\\Users\\damon\\anaconda3\\python3, but I would check just to make sure.

damonbla commented 4 years ago

That fixed it! Thank you so much. The working line included .exe as well:

"executable": "C:\\Users\\damon\\anaconda3\\python.exe"
mandeep commented 4 years ago

Awesome! Glad it worked :)

mandeep commented 4 years ago

I'm reopening this issue as I realized that Conda (Windows).sublime-settings shows the executable path as ~\\Anaconda3\\python without the .exe suffix. This is probably confusing so I think the exe extension should be added.

mandeep commented 4 years ago

Fixed by 0bcf5a56dcc8626e3fa3ee42a4b7f4ee5da6d7e8