Sublimetext suddenly won't build .py script (Anaconda3). KeyError: 'conda_environment' - sublimetext

SOLVED. Apparently I somehow deactivated my Conda environment. Typing Conda: Activate Environment into the Sublime console fixed it.
I'm using Anaconda3 to run scripts developed at my workplace. I had set up SublimeText to view/edit the scripts and to run them using the build command. Until today, I had been able to run scripts normally.
Today, however, some of the commands are not enclosed with white boxes and I get an error command which trying to build the script.Here's a screenshot showing the markings and error message
I first restarted my computer to no avail. I then uninstalled and re-installed packages for Conda and Anaconda but that also failed to fix it. Googling "sublime conda not building" gave me results which concerned error messages while building a script and not being unable to build entirely. I also can't find a match to my specific error message.
Any insight? If it's not obvious, I am a novice to python & sublime. Thanks.
EDIT: The white boxes are now gone. More importantly, apparently they're related to linting and are (likely) not related to the script not building which is the primary concern.
EDIT2:
URLS for plugins Conda and Anaconda
I wasn't able to find conda.sublime-build, but I found conda.sublime-settings which I think is the same thing. If not, please let me know where to look. (this was under user packages). These settings are pasted below.
// Default Windows 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\\26036\\Anaconda3\\python.exe",
// Directory in which the conda envs are stored
// Default location is the user's home directory
"environment_directory": "C:\\Users\\26036\\Anaconda3\\envs\\",
// System architecture for Python installation
// options: 32 or 64 bit
"architecture": "64",
// configuration is the path to conda's configuration file
"configuration": "~\\.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": false,
// when true, the script execution will be handed over to
// the pythonw executable, instead of python
"use_pythonw": false,
// open repl in second row tab below current file,
// closing any existing tabs in that area
// assumes files are kept in group 0 (typical)
"repl_open_row": false,
// when opening a repl using repl_open_row, close any
// existing conda repls in the second row first
"repl_row_close_existing": false,
// save the current file (if dirty) when opening repl
"repl_save_dirty": true,
// syntax highlighting for Open REPL command
// choice between 'python' and 'plaintext'
"repl_syntax": "python"
}
EDIT3: I have both Conda and Anaconda3 packages installed. When it was working, I selected Conda as my build system. I'm sorta sure the environment was activated because I was able to run the script beforehand but perhaps the environment got deactivated?

Turns out my Conda environment was somehow made inactive. Typing "Conda: Activate Environment" in the Sublime Console fixed it. Thanks MattDMo for suggesting I check it.

Related

libtinfo.so.6: no version information available

After installing cuda and cudnn with miniconda, whenever I start a new shell with the current user. I am always getting warnings about /usr/bin/zsh: /some/path/to/miniconda3/lib/libtinfo.so.6: no version information available.
It seemed that $LD_LIBRARY_PATH is set to /some/path/to/miniconda3/lib, but after extensive digging (examined all possible rc files in etc, $HOME, I am still unable to locate where exactly this variable is set. Also echoing $LD_LIBRARY_PATH on the top of every RC file yields this path (both login shell and non-login shell).
I would like to find out a way to disable this warning (presumably by unsetting LD_LIBRARY_PATH, is there any suggestions?
EDIT: After restarting my desktop, the error went away.. Is there any explanation why this happened? Is there some other config being executed prior to starting up the shell (in some cache file) which will be cleared after reboot?

stupid nube cant even do one simple code test [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 10 months ago.
Improve this question
I decided recently that I want to start learning to code. I chose python as my first language because of it's versatility and Open Source connections. Now, of course to learn any programming language, first you have to be able to practice with it by writing code and running it.
I have Python beginner tutorials I am using but as soon as I got to the point where I wanted to run a simple Hello World message, I couldn't figure out how to get my document to actually RUN. I downloaded LiClipse with the hopes of using PyDev. I read that you can run a code directly from PyDev.
Wow, what a confusing mess! I downloaded the instant install version of LiClipse and I had to manually update the pip because it was out of date and that took an hour of research all on it's own to figure out how to do it.
Now that I have the interpreter set up correctly with the most recent pip...(I THINK), when I try to run any code I write, it doesn't let me. It wants me to save it first, which of course is quite logical. But when I try to save it, it says there is no folders to save to. How can there be no folders? I have been reading the install help, but it doesn't say anything about this issue. Or maybe it did explain how to fix this issue and I simply didn't understand all the jargon included in the configuration documentation. It kept instructing me to do technical things I couldn't understand.
Can anyone tell me what is going on? Shouldn't this all be ready to go when I used the "instant install" ?? I am just a beginner here, I don't know all this technical installation jargon. If anyone can help me get this setup, please let me know.
I really want to start learning. But I can't if I don't have the right tools.
Yeah, the technical jargon can be really confusing in the beginning. I've never heard of LiClipse but I can give you a few tips to get started:
Use a good IDE or Editor. For beginning VsCode with the Python PlugIn is quite good. You can also use PyCharm (the free version is enough) but that IDE is quite confusing.
Get comfortable with the commandline. On Windows you can invoke Python by running py on Linux with python3. You open the commandline on Windows by opening the startmenu, entering cmd and hitting enter.
You will have to make sure Python is in your "PATH" enviroment variable. That is a variable telling the Operating System where to find your programms. It should have asked you whether you want to add Python to your PATH during the install.
You run your python programm by saving it as a .py file and running py <filename.py> or python3 <filename.py> on Windows or linux respectively. You have to be in the directory where you saved your file of course.
I hope I could help you. Please mark this answer as accepted if it did answer your question or helped you with your issue.
I want to start by saying I'm mainly experienced in C & C++, not Python, but with programming in general many of the concepts carry over. I also don't have enough rep to comment, or I'd ask for some clarification on how familiar you are with the commandline.
I'm going to assume you're on Windows since you didn't mention the platform.
I wrote this like a tutorial, because I found those to be very helpful when I first started programming.
I can't recommend this enough, start off by using the commandline!
I think you complicated things more by searching for a text editor that can also run code. In order to get something like that working for your setup you need to know what's happening behind-the-scenes first.
Once you have a grasp of how to write & execute Python code, then you can move on to an IDE or advanced text editor like Visual Studio Code or LiClipse with confidence.
R+Click on the Start Menu, then click on Windows PowerShell to open a terminal.
Take a moment to note the filepath shown before the blinking cursor.
This is known as the Working Directory, which works similar to how the file explorer only allows you to "view" one directory at any given time; You can open multiple explorer windows side-by-side, but you can't view multiple directories at the same time in a single window.
You can run commands by typing them and pressing Enter.
You can also use the Tab key to autocomplete things like directory/file names, commands, etc. after typing a few characters.
Now let's create a workspace directory for your first project.
This can be anywhere that you choose, but for the sake of simplicity I'll be using my User directory which is usually where PowerShell will start by default.
To create a new directory named _workspace, use the mkdir (Make Directory) command like so:
mkdir _workspace
Now let's change our working directory to _workspace by using the cd (Change Directory) command like so:
cd _workspace
This directory is empty, but if you want to view the contents of a directory you can use the ls (List Directory) command:
ls
Since this is an empty directory, nothing will happen.
Next, we'll create a Python script file using the touch command, which creates empty files:
touch HelloWorld.py
Now that we have a script file, open HelloWorld.py in Notepad by running this command:
notepad HelloWorld.py
If you use a dark desktop theme, now is the time when your retinas may be seared out by the intensity of Notepad's white color scheme.
Now, let's add the code to print "Hello World!" in Python:
print("Hello World!")
Once you're done, you can save & close Notepad to save your retinas.
Now it's time to run the program! In the PowerShell window, enter this command:
py HelloWorld.py
which will show:
Hello World!
If you see an error saying this:
The term 'py' is not recognized as the name of a cmdlet, function, script file, or operable program.
You should re-install Python and make sure you check this box in the installer:
After re-installing Python and checking the Add to PATH box, close and reopen the PowerShell window, enter the cd _workspace command again, followed by py HelloWorld.py, which should be successful this time.
I hope I could be of some help, if so, I'd greatly appreciate marking this answer as accepted so I can write comments. Happy coding!
If you are using Linux following will work.
Install python3 first (Its better to stuck on python3 now. Once you get use-to then you can code in python2.7 also.)
Open a terminal, go the folder contains your code. If your source code is in hello.py then type python3 hello.py on terminal. It will execute and print the output on terminal.
The suggestions given by both #radj and #C. Dautermann are excellent.
Like others here, I will be assuming that you are on Windows.
Before jumping into LiClipse and PyDev, I highly recommend making sure that Python and packages (such as pip) are functioning on their own first. Command line is a great tool for this.
Windows Command Line can be accessed in a variety of ways, one of which is to go to your start menu and search "cmd." Command Prompt should return. In the command prompt, run the following:
python
This should return the version of Python installed on your machine if it is configured properly. For example, you may see the following:
Python 3.10.1 (...)[...] on win32
If this does not appear, I recommend uninstalling Python and reinstalling. In the installer, you will want to check the "Add Python ... to PATH" option. This will configure your environment variables on your machine. If you plan on running multiple versions of Python down the road, don't worry; you can use batch files to set the PATH variable to another version.
Once you have Python working, your command prompt will lead with the following:
>>>
Notice that there is no longer a file path followed by >>. This is because you are now in the Python interpreter. Congratulations!
To exit the Python interpreter, enter Ctrl+Z. It should appear as the following:
^Z
After we know Python works, we will check to see that pip works. Ensure you have pip installed by entering the following:
python -m pip --version
You should then be able to see the pip version. For example:
pip 22.0.3 from C:\...
If pip is not working, you can consult this documentation on pip to make sure pip gets installed properly.
Once pip is working, again, congratulations! You've gotten over some of the biggest hurdles. At this point, you can open up any text editor, type in:
print('Hello World!')
save the file with the extension .py, then run the script through command prompt. To run a script through the command line, you have to cd to the file location, then run the script with python, like so:
cd filepath
python filename.py
Where filepath is the path to the Python file and filename is the name of the file. For example:
cd C:\Users\name\Documents\PythonPractice
python helloworld.py
Usually, command line is all that is needed when starting out with Python outside of a text editor. Notepad comes standard on Windows computers, but there are plenty of other editors out there. Sublime text and Notepad++ are some of my favorites, personally.
Now, if you're able to run everything prior, the good news is that your Python and pip are both working, and you have everything you need to get started learning Python. If Python and/or pip are not functioning, there's thankfully a huge body of troubleshooting tips out there.
Unfortunately, from what I get of your initial post, you might be struggling with configuring LiClipse. I personally do not use LiClipse, nor do I use PyDev, so my help at this point may be limited. You may want to uninstall and reinstall after confirming your Python and pip work as a first step. After that, perhaps check that you are following the practices outlined in the LiClipse manual. Worst case scenario, you can try a different version of Python (I believe it has some Python3 incompatibilities), try running PyDev independent of LiClipse, or look at a different tool. If you believe the problem lies with file locations/existence, I would look at radj's post or play around in File Explorer to see what is going on for yourself.
Again, to get familiar with Python, you don't even need these extra tools. All you need is a text editor and the command line to get started.
Some other tools to help you get started:
PyPI
A venv virtual environment tutorial
PyDev
A comparison of LiClipse alternatives in case you continue to struggle
Hope this helps. Happy Coding!

anaconda spyder sqlite3.DatabaseError: database disk image is malformed

I've run into a problem running Spyder that I can't seem to resolve. Any help would be appreciated.
I've been using Anaconda Spyder on Windows 7 without much trouble. I had to do a hard shut down of my computer while Spyder was running. When I turned it back on, Spyder loads with the error while starting the kernel: "sqlite3.DatabaseError: database disk image is malformed". The first few lines of the specific error are
Traceback (most recent call last):
File "C:\***\Anaconda3\lib\site‑packages\IPython\core\history.py", line 87, in catch_corrupt_db
return f(self, *a, **kw)
File "C:\***\Anaconda3\lib\site‑packages\IPython\core\history.py", line 257, in init_db
end timestamp, num_cmds integer, remark text)""")
sqlite3.DatabaseError: database disk image is malformed
Following this there is a list of other exceptions which occurred but I imagine they are related to these first lines.
I've tried checking SQlite3 using PRAGMA integrity_check but it did not return any errors.
I've uninstalled and reinstalled Anaconda but the problem persists.
I've spent a number of hours over many days trying various fixes in online forums but can't seem to figure out the one that works for me.
I'd really appreciate some guidance, thanks
I was able to work through the problem with a colleague and the solution was to delete the files contained in the IPython Profile Directory. When the kernel was restarted, it recreated the needed files in the directory and Spyder was back to a usable state.
Test to see if this method might work:
Open the IPython prompt and try running ipython command. This gave me the same error as was given in Spyder this led us to the conclusion that it is an IPython issue, since Spyder references the IPython profile.
Create a temp directory somewhere convenient, go back to the IPython prompt, and change the IPython Profile Directory to the temp directory you created. You can do this by entering ipython --ipython-dir=<path> which is outlined here: https://ipython.org/ipython-doc/3/config/intro.html#ipythondir. Note that for windows you would enter something like ipython --ipython-dir=C:\tempFolder. Again run IPython. You should now be in a python script and if you check the tempFolder, you'll see that it has created new folders inside it.
How to correct the issue:
The profile directory can be found by opening Spyder, going to Tools → Preferences, then in the pop-up window go to the "Profiler" tab. The directory is listed on the right side of the pop-up window.
You then must go to that directory and delete the folders contained inside it. In my case, there were 3 folders. In Spyder, go to Consoles → Restart Kernel.

"The system cannot find the path specified" when compiling SASS

I'm trying to learn SASS and so I have installed ruby through RubyInstaller and installed the sass gem.
I am able to type out my sass and have the compiler watch the file and write to another just fine, but every time I save my file I get
The system cannot find the path specified
C:\Program Files (x86)\Notepad++)
However everything works as intended, the styles are updated and compiled just fine, but it's quite annoying hitting ctrl+s and having that error keep popping up when it doesn't seem to be affecting anything.
How do I go about troubleshooting this?
Here is a solution for anyone else having the same trouble on notepad++:
Sass-Auto-Compile
For using the Sass-Auto-Compile plugin, you first need to install
another plugin called jN. jN is a plugin for Notepad++, which executes
your JavaScript-scripts in the Notepad++ environment, meaning you can
write plugins in JavaScript
this is the link :
http://www.ninjagame.de/blogContent/Sass-Auto-Compile.js
To get the auto-compiling working, you need to do two things:
Copy this script into the directory “Notepad++/plugins/jN/includes/” .
Now edit the script and change the variable pathToRubyBinDir to the
right value. Mine is: “C:/Program Files/Ruby193/bin/” .
OPTIONAL: There are two more configuration variables:
debugMode: can be true or false. In case of true, you will see the
command line, which calls the compiling process. You can see compiling
errors in this command line window.
outputStyle: this determines, how your .css is going to look like.
(compressed, extended…). See the comments above this variable for more
information.
This guide is copied and pasted from http://deekaysblog.wordpress.com

can not find ipy_user_conf.py for Enthought python

I have EPD. I would like to use the ipython shell. I think it's called 'pylab' in your distribution. I would like to be able to append to the system path ($pythonpath) at the moment when the shell loads. Unfortunately, I can not seem to locate the ipy_user_conf.py file that many users on the internet report is where I need to include a line to do that. Please help!!!
I'm going to guess that you're running IPython >= 0.11. (Note the IPython version is displayed when starting up the IPython shell.)
Older versions of IPython (pre-0.11) used ipy_user_conf.py, but IPython's configuration system was overhauled in 0.11. For details, see this overview. If you want to run some code on start up, you can add a python file in your IPython startup directory, which should be here:
~/.ipython/profile_default/startup/
Any python code in that directory gets run on startup, so you can just create a new .py to modify your python path. If the startup directory doesn't exist, you may need to run:
ipython profile create
which creates those directories (plus some other goodies).

Resources