Open haferburg opened 3 years ago
+1 on this... I first got this about 2 days ago and got so frustrate I deleted Sublime entirely. Re-installed ST3 today and everything works fine except for Anaconda. Same error as this.
Here are my Windows specifications:
Edition Windows 10 Pro
Version 21H1
Installed on 10/07/2021
OS build 19043.1237
Experience Windows Feature Experience Pack 120.2212.3530.0
And if you're looking for my logs, here they are: Python Folder: https://pastebin.com/aj5AD4Fm Downloads Folder: https://pastebin.com/bmE5YkVf
Although, I fear I may have played a part in this by updating Python to 3.10 and deleting the 3.9 Folder...
By the way, the swallow_startup_errors
is only to stop the pop-up I believe.
I got the same error on Windows and was able to fix it, though I'm not sure if it's due to the same bug you're experiencing.
What worked for me:
First, cd
to the Anaconda Package directory.
Try running the server:
python anaconda_server\json_server.py
For me, the server failed to start for two reasons--
1) The lib.path
import at the top of jsonserver.py
fails because on Windows, there is a built-in module with the same name (lib
).
I was able to fix this by editing jsonserver.py
-- namely inserted the Anaconda\anaconda_server
directory into sys.path
-- something like:
sys.path.insert(Path("CORRECT_PATH").resolve())
2) Windows firewall was blocking the server, which is why there's not a more informative error message than the one you're getting.
I recommend setting an application-specific rule in Windows firewall, as the port can change.
Apologies if anything isn't exactly correct, currently on my phone. I'll check it again when I'm back at my computer. Also, I'll submit a pull request when I have a chance.
This error is due to the python version that is being used to run jsonserver.py
. In macOS, if using homebrew, and you have installed the latest Python, the script will not run. Here is the error when running the script directly in Python 3.10.4:
% python3 jsonserver.py
/Users/demo/Library/Application Support/Sublime Text/Packages/Anaconda/anaconda_server/jsonserver.py:13: DeprecationWarning: The asyncore module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio
import asyncore
/Users/demo/Library/Application Support/Sublime Text/Packages/Anaconda/anaconda_server/jsonserver.py:14: DeprecationWarning: The asynchat module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio
import asynchat
MyPy is enabled but we could not import it
Usage: jsonserver.py -p <project> -e <extra_paths> ST3_PID
jsonserver.py: error: you have to pass a port number and PID
The solution that I found for this is to specify the interpreter in Anacoda's user settings. Use the following menu path to edit the user settings for Anaconda:
Sublime Text Menu > Preferences > Package Settings > Anaconda > Settings - User
In the settings file, add a python_interpreter
field that points to the system python (3.8.9 on macOS). If you have another one installed elsewhere, just point to the absolute path of that location.
{
"python_interpreter": "/usr/bin/python3",
}
I'm using pyenv, so I changed the python_interpreter
to the output of which python3
, pointing to the .shims directory.
This did not help. I had to go to ~/Library/Application Support/Sublime Text/Packages/Anaconda
and change .python-version to match the version number I'm using.
No more error messages, but the server launched the first time I opened a python file and won't start again after closing sublime and starting it again.
Entire thing feels very fragile.
How will i do in Window? Is therea more definitive answer on this point by chance?
I had to go to
~/Library/Application Support/Sublime Text/Packages/Anaconda
and change .python-version to match the version number I'm using.
Wow. Good find. This worked for me too. For me, the path was ~/Library/Application Support/Sublime Text 3/Packages/Anaconda/.python-version
. Changed 3.8
-> 3.12
(my system's default conda env python version). Thanks.
I'm using pyenv, so I changed the
python_interpreter
to the output ofwhich python3
, pointing to the .shims directory.This did not help. I had to go to
~/Library/Application Support/Sublime Text/Packages/Anaconda
and change .python-version to match the version number I'm using.No more error messages, but the server launched the first time I opened a python file and won't start again after closing sublime and starting it again.
Entire thing feels very fragile.
Very helpful, thank you!
I'm using pyenv, so I changed the
python_interpreter
to the output ofwhich python3
, pointing to the .shims directory.This did not help. I had to go to
~/Library/Application Support/Sublime Text/Packages/Anaconda
and change .python-version to match the version number I'm using.No more error messages, but the server launched the first time I opened a python file and won't start again after closing sublime and starting it again.
Entire thing feels very fragile.
This worked for me in late 2024.
I switched from a normal Python installation on Windows 10 to pyenv.
Now I'm seeing this error in Anaconda 2.20.0 with ST 4107:
There is no Python process running jsonserver.py.
This is frustrating because the error message says "If there is...", but not "if there isn't...".
The error message also says "could not start because...", which suggests to me that it's going to tell me a reason why it didn't start, but then only describes the result, namely that the server is unreachable.
I have
swallow_startup_errors
set to true, but it still displays the error. There is no popup, though.I don't think Anaconda is working. What is odd, though is that running a Python script with the Anaconda Python Builder is working fine.
I found #527, and it's marked as fixed with no comment in the commit message, but I'm still seeing this error message. That is quite frustrating. There's a lot of comments in that issues, and I'm not going to read them all.
It would be great if you would consider changing the error message. At this point I would like to know what Anaconda tries to do, i. e. how does it start the server. Let me know the full command line. Where does it take the Python exe from? What is the output to stderr, stdout when it tries to run?
Also, it would be great if Anaconda would stop printing the same error message every couple seconds. It is my understanding that Anaconda is responsible for starting the server. It didn't, now the server is unreachable. It's cool that Anaconda checks a couple times, but unless it actually tries to restart the server, it should stop trying to connect to it. Unless there's a good reason why that would suddenly work.
To me it looks like - and I'm not familiar with the code at all - error handling is missing when Anaconda tries to start the server. The error message that I'm seeing is complaining about the result from not being able to reach the server. But Anaconda should have told me why it couldn't start the server. The error message above suggests that, but is misleading.