DataSpell: Create python virtual environment using DataSpell - virtualenv

How to create a virtual environment and activate it using DataSpell?

If you open a directory or a project to the DataSpell workspace, it automatically creates a virtual environment. But, if you want to use a different python version, you can always create another virtual environment.
Steps to create a new virtual environment: I have used conda environment. So, I am showing here how to create a new conda environment.
Go to File -> Settings -> Project: workspace -> Python Interpreter. Or simply press
Ctrl+Alt+S from keyboard.
Press the settings icon from the right corner and click the Add.. button. Then click on the New environment radio button. Select your python version and locations.
Give a name to your environment.
Click on the Make available to all projects checkbox if you want to use this environment for other projects.
Press the OK button and then the OK button again.
You can change the virtual environment for your project as follows,
Like this image, on the bottom right corner of your DataSpell, you see the environment variable. If you click it, you will also see the list of the loaded projects and corresponding environment variables there.
You can change your environment variable for the specific project from here.

Related

How to run system shell/terminal inside Eclipse?

I am using Eclipse Neon, and I would like to execute system commands on a shell/terminal, inside Eclipse.
In particular, I will need to open the system shell using the path of the current project folder on which I'm working in Eclipse.
In some Eclipse packages, like STS or Eclipse for JEE Developers, the Terminal is already installed in your IDE. If not, you can install the TM Terminal from the Eclipse */release update site, as you can see in the image below.
To open the command prompt (shell or terminal) using the path of a project directory inside Eclipse, you just need to select the folder, and press Ctrl+Alt+T, or right-click and select Show In Local Terminal > Terminal.
Then, the terminal will open in a new view inside Eclipse.
The Eclipse IDE which I am working there is no Terminal is there. So I needed to add the plug in like this and it works fine when you try clicking Alt+Ctrl+T
Click on Help in Eclipse-->Eclipse Marketplace--> in Find box (Search terminal and Enter)--> You will see TM Terminal 4.0 Version and just install it.
You may need to restart afterwards
And finally you will be able to get the Terminal when you will type
Alt+Ctrl+T on Console.
If you don't have the TM Terminal plugin installed, you could use external run configurations.
Click on the arrow near run button with the toolbox and add a new external run configuration.
Here, you can enter the path of your program(if you want to run commands, it will be C:\Windows\System32\cmd.exe (or the path to PowerShell on windows and /bin/bash (or similar if you use another shell) on linux.
In this dialog, you can also specify running directory of the application(the current project in your case)
After that, you can save this configuration and start it using the external run configuration menu(run button with toolbox)
Click on Run Cofiguration--> arguments --> Program Arguments (write any number of String) -->click on run
Go to Window > show view > Other.
A dialog will show up, type Terminal in the search field, select Terminal and click open.
A new empty view will show up in Eclipse.
On the top right corner of the view there is a button Labeled "open a Terminal".
Click on it, a dialog will show up
click OK and there you go, you got a Terminal.

Is it possible to set which file to run by default in eclipse?

I'm writing a python project in Eclipse with the PyDev plug-in, which contains multiple files.
However I'm used to using visual studio, where it'll automatically find the main function of a project and run the program from there.
Eclipse will always run the file I am currently editing (which usually is a file containing function that are called from the main function).
Is it possible to set which file should be run then clicking run? I've looked at the launch options under Project->Properties->PyDev, but didn't find what I was looking for.
When you press the Debug or Run button (Debug on the left) Eclipse tries to intelligently determine what to launch based on your current editor.
You can change the behaviour by editing Window -> Preferences -> Run/Debug -> Launching -> Launch Operation as pictured below.
The default of launching the current editor works well for some languages, but not as well for Python when every single file is itself a valid program to run. In your case I recommend changing to Always launch the previously launched application.
You can create a custom run configuration.
Right click on your project > run as > run configurations
From here is just a matter of choosing your project type on the left hand side and filling in the required information. You can click 'Run' to use your new configuration.
To get to this configuration again, you can click the 'Run' drop down button in the eclipse tool bar and see all of your run configurations.
Hope this helps!

Golang on eclipse: "Resource doesn't have a corresponding Go package" on Mac

As stated in the title, I have a problem running the Golang code on Eclipse. I'm currently using Mac, and I installed go by using homebrew.
Currently, the folder where go is installed is as follows.
/usr/local/Cellar/go/1.5.2/..
and after running Terminal and typing open ~/.bash_profile I added the following.
export GOROOT="/usr/local/Cellar/go/1.5.2/"
export PATH=$PATH:$GOROOT/bin
Am I still missing something else?
PS If I run the code using Terminal like go run main.go, I have absolutely no problem. The problem must be due to some misconfiguration in Eclipse.
I had the same error. Putting the source file under a sub-folder in src fixed it.
Go to 'Run Configurations' -> Filter with Go Application -> select your project and then click the Environment tab, then click on select button and tick the GOPATH environment. select apply and then Run.
I had the same problem and I did two things to solve it:
I opened Run configurations, filtered using "Go" and created a new configuration (right click on "Go Application" as a result of the filter). In the Environment tab added a new variable: GOPATH = [path to your workspace].
I had .go files right under src folder, and this is wrong. I created a folder under src folder and moved .go files to that folder.
The first step could be replaced by creating a system environment and adding it to the list using the "Select" option instead of creating a new one. I prefered to create a new one so I can run differente projects in the same laptop without having to change the value of the system environment.
Because the executable path is not right.
GoClipse compiles source into $project/bin, so we must set GOPATH = $project
Select project > Alt+Enter > Go Compiler > Use project specific settings > Eclipse GOPATH
In my case of wiki tutorial, GOPATH = :/home/sovann/go/wiki.
Then the IDE is able to locate /home/sovann/go/wiki/bin/main

How do you set environment variables for Enide / Nodeclipse?

Anyone know how to set environment variables for running and debugging Node.js applications in Eclipse + Nodeclipse aka Enide Studio? For example, in a .js file, an environment variable can be referenced as process.env.PORT, for the environment variable PORT. How can I specify this variable within Enide?
I found the solution to my question. First, go to the menu item File > Properties. Then select Run/Debug Settings from the options on the left of the dialog. Then select the .js file for which you want to set an environment variable during debugging/running programs in Enide Studio / Eclipse + Nodeclipse. Then select the [Edit] button. On the dialog that appears, select the [Environment] tab. Then select the [New] button and enter in your desired variable name and value. Repeat for multiple environment variables. Click [Apply], then try running your program. Your environment values should be available as process.env.YOUR_VARIABLE_NAME in your Node.js source code.

How to forbid creation run configuration in PyDev

Each time I press run button (or using shortcut for it), eclipse creates run configuration in some unpredictable way (looks like it uses currently selected file in PyDev Package Explorer, which is very strange). How to force eclipse to use only manually created run configurations and forbid to creating new one for the current project. I have 'Always launch the previously launched application' checked, but it doesn't help.