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.
Related
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.
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
I installed python via anaconda on an EC2 Ubuntu Instance.
The command which python returns */home/ubuntu/anaconda3/bin/python*
Jenkins is instead installed in */var/lib/jenkins*
I am trying to run a simple "Hello World" script saved on a file named *test.py* and located within the */home/ubuntu/scripts/* folder.
While running *python /home/ubuntu/scripts/test.py* works on terminal, it fails as an "Execute shell" build step in Jenkins.
Why and how do I configure Jenkins to run python scripts step by step?
The issue was that the anaconda python installation was only available to the user "ubuntu". For Jenkins to be able to run python scripts, the "jenkins" user needs to use that installation.
To solve the problem, this is what I did:
Logged in as jenkins with the command sudo su -s /bin/bash jenkins
Edited the python install location as export PATH=/home/ubuntu/anaconda3/bin:$PATH
Checked that the path is correct through which python
Logged back as ubuntu user
Restarted Jenkins through sudo service jenkins restart (not sure if necessary)
Now I can run python scripts through Jenkins.
For the last 3 days, I have been trying to set up virtual Env on Vs Code for python with some luck but I have a few questions that I cant seem to find the answer to.
Does Vs Code have to run in WSL for me to use venv?
When I install venv on my device it doesn't seem to install a Scripts folder inside the vevn folder. Is this out dated information or am I installing it incorrectly. I am installing onto Documents folder inside my D: drive using python3 - m venv venv. The folder does install and does run in WSL mode but I am trying to run it in clear VsCode so I can use other add-ons such as AREPL that doesn't seem to like being ran in WSL.
For extra context I have oh-my-ZSH set up and using the ubuntu command line on my windows device. Any information will be helpful at this point because I am losing my mind.
venv folder in side D: drive
result
If you have the python extension installed you should be able to select your python interpreter at the bottom.
You should then be able to select the appropriate path
Run Set-ExecutionPolicy Unrestricted -scope process before activating virtual environment.
All the best
You don't have to create a virtual environment under WSL, it will work anywhere. But the reason you don't have a Scripts/ directory is because (I bet) you're running VS Code with git bash and that makes Python think you're running under Unix. In that case it creates a bin/ directory. That will also confuse VS Code because the extension thinks you're running under Windows.
I would either create a virtual environment using a Windows terminal like PowerShell or Command Prompt or use WSL2.
I'm trying to create a simple virtualenv environment; python and virtualenv are both installed. When I go in to my directory in which I am trying to make this environment, I keep getting a Windows Script Host popup box:
Script: *My path to virtualenv.js*
Line: 1
Char: 1
Error: Object expected
Code: 800A138F
Source: Microsoft JScript runtime error
I went in to my file to see where the problem may have lied and assumed it was just a module I hadn't installed yet, though all of them are in the node_modules in my package. I'm not sure where else this issue is coming from?
It looks to me as if you have a virtualenv.js JavaScript file on your path, and that JS files are associated with Windows Scripting Host on your machine. (Perhaps you have the node-virtualenv project installed, which puts a JavaScript file with the name virtualenv.js in your path?)
To create a typical Python virtual environment, you want to invoke the (Python) virtualenv.py script. Assuming you've installed virtual environment with:
pip install virtualenv
Then you can use:
python -m virtualenv ENV
to invoke the Python interpreter directly, and have it load the appropriate virtualenv.py script file on your path.