Recently I've installed conda (the package manager) on my Ubuntu.
Now whenever I open a terminal it appears like this:
(base) myName$
I had a crontab task that I was expecting to run but when I checked, the crontab file was empty.
Also, I used to be able to run from the terminal a python script that used selenium. I still can run the program if I use the python IDLE, but now it doesn't work when I run it from the terminal. I get the following error:
ModuleNotFoundError: No module named 'selenium'
Is it possible that conda has done something to my files?
I solved it. I just had to run the cron demon because it had stopped.
Related
I understand that you can run a python script from the command line by entering in the file name. What changes do I need to make with a file that has dependencies?
To be more specific, I'm using Pycharm with a specific Anaconda environment for a project. This environment has packages included such as tensorflow and keras. I can run it directly from Pycharm, however when I try to run from the command line, it gives and error saying that
"there is no model named 'tensorflow'"
What can I do to the command line to signal that it should be using a conda environment, let's call it Env1. I've tried activating the environment in the conda command shell and I still get the same problem. How can I address this?
Thanks
a colleague of mine has written a python script that I need to use, which is called within a shell script. It produces plots with matplotlib. However, when I try to run his script, it fails in matplotlib commands with "ImportError: No module named PyQt4". The python script is called within the shell script with a syntax like
./script.py
script.py begins with a line to specify the python exec to use from within his miniconda environment, like
#!/user/miniconda/envs/py27/bin/python
I think the problem is that the code uses the default PyQt on my system when I run this command. I tried running script.py with the python exec in his environment, but this gives the same error. This also occurs if I try to run the script on his computer when logged into my account. Is there a way that I can run this script as if I were my colleague within my account?
Have your colleague generate a yaml file with his environment dependencies, then create a copy of his environment on your computer to run the script.
# your coworker runs:
conda env export -n [name of his environment] > environ.yml
Once you get yaml file, you can run
conda env create -f environ.yml
to copy the environment. From there, activate it and run the script
# on Windows
activate [environment name]
python ./script.py
# on *nix
source activate [environment name]
python ./script.py
I have a problem with my apache server (Shared Hosting, no root).
I've installed a python package via SSH-Terminal (with pip install) under ./local/lib/python2.7/site-packages/.
There is a python file which imports this package. When I run the python file via the SSH-Terminal everything works fine.
But when I run the python file within a php exec command
exec("/usr/bin/python myscript.py 2>&1", $out, $result);
an error occurs:
"ImportError: No module named XXX".
Do you know what went wrong here or what I can do to make the script work in the browser as well?
Thanks in advance
I have a python script that processes excel files. I this script is run via python from the command line, it runs as expected but when I run from incron, it does't appear to see my imports, such as pandas
this is how I call from incron:
file/to/monitor IN_CREATE,IN_MOVED_TO /usr/bin/sh /my/main/shell/script
this is how my script looks like
#!/usr/bin/env python
source activate my_env
python /absolute/path/to/python/script
and now as I check on the logs, from abrt,
step1.1_executeConsolidation.py:2::ImportError: No module named pandas
I'm thinking this is just an environment issue with incron, but I'm not sure how to set it up properly.
I use anaconda by the way. If run manually, I don't have any library dependency issues
After 2 weeks, my request to install anaconda at work finally got accepted and after small struggles with windows (coming from mac) I finally got my script working but now I can't seem to execute my script outside of the spyder editor included in anaconda. I want to run my script over Anaconda Prompt but whenever I run the script I get the following error:
Since the error already occurs in the first line I will spare you the rest of the code. But as mentioned before, the script works perfectly fine in spyder but causes an SyntaxError in anaconda prompt. The referenced cmd module is this one: https://docs.python.org/3.4/library/cmd.html
Note: I tried pip installing cmd but couldn't. I am guessing because of my missing admin rights. Instead I just copied the code for the module into a py file into the folder of my project. It works completely fine in spyder.