Hi I am currently using pycharm to work on a python project. I am mostly running the code on a remote server which I have easy ssh access to. I currently have pycharm setup that I can easily upload/download files and use the ipython console with my environment. However, to fully be able to use the resources of the server I need to be able to run a linux command before running my python files or calling ipython so that I can have the resources I need to debug and whatnot. Is there a way to tell pycharm to run a specific command before starting my remote environment for the ipython console. (i.e instead of it doing conda activate environment; ipython it would do linux command; conda activate environment; ipython?
Thank you
Related
I am currently trying to debug a numpy code that I wrote using Gdb. To do that I activate first my virtual environment(on the command prompt) using the following commands (numpy_dev_env is my virtual environment)
numpy_dev_env\Scripts\activate
After that I activate my virtual environment.
gdb
then type "python" to start coding in python (all these steps work good for me).However, I realized that my test were not ran on the virtual environment,but instead on python system available in MINGW. I would appreciate your advice on ways to run the virtual enviroment with gdb.
Thank you,
I tried to configure the .gdbinit file in my home directory.I however did not know how to do with that
edit. clarified that when I run python on gdb the system used is the one available on MINGW and not of my system
Ensure that you are running the correct version of Python: start python in one shell, search for the process id using your task manager, then start gdb and attach the process.
Alternatively, start gdb with the full path to your python inside your environment.
I am currently using VS Code on a server (through SSH). Everything works fine, and I installed Python packages and work with Python notebooks.
Now, I want to login to the server (not a problem) and run the Python code I created on VSCode, rather than executing it remotely.
My main issue is that I am not sure how to activate the Python environment (if there is one) that VSCode server's run so that the code can execute.
Is that possible?
I see I have a .vscode directory in my home directory, and there are package installation there.
After connecting vscode remotely, you can use it as a regular vscode, which is no different from running Python files locally:
install python
install pylance extension
choose correct interpreter
edit your code and run the python file.
I create a virtual environment named djangoenv. I can run it with using cmd but I cannot in python terminal
this is cmd picture and this is python terminal picture
how can I run this server in python terminal?
Your script is block cause of execution policy.
running this commend on windows PS may work for you
Set-ExecutionPolicy RemoteSigned
Have you tried running your django server?
This seems to be common when using Windows PowerShell, indicated by the prefixed "PS" in your second screenshot. For me it looks the same. Note: I am using Pipenv vor virtualenv management, but I think it also uses virtualenv, so the error should be the same.
CMD:
PowerShell:
For some reason, it only shows the environment name in CMD, but not in PS. Still, I am in the same environment for both sessions.
Just try starting your server.
I am really struggling to be able to debug python that runs in an anaconda environment that is installed in a docker container (that also runs on the same host). I do not have the Dockerfile of the docker image.
I do have installed a docker remote extension in visual code.
My host runs Ubuntu 18.04LTS.
I can run the docker image from the bash shell in VSCode and activate the correct anaconda environment but then I need to select the python interpreter from that anaconda environment but I cannot select it in VSCode.
Only the python interpreters of the host system are visible for selection.
I may be overlooking something here. Any tips/help is very much appreciated.
Thanks in advance
Hi all I am working with IBM AIX remote server and cannot get the python inside the virtualenv to execute, though I have activated the virtualenv. I created the virtualenv on my mac machine with the all the dependencies installed required to run the project as I don't have the admin privileges on the AIX box and need to deploy and run my app on the server.
I was able to activate the virtual environment on the aix box by running the below command
. ./project_name/bin/activate
I tried running the file using the path to the python inside the virtualenv
/u/.../project_name/bin/python2.7 myfile.py
but go the error
ksh: ./bin/python2.7: cannot execute
Whenever i try to check the python that is currently being executed I get the system python path as a result
which python
/bin/python
I want it to execute the python inside the virtualenv and use the libraries that I have installed in there for the app I want to run. Any help would be appreciated.