How to create environment.yml without using anaconda prompt - selenium

I have tried creating environment file but unfortunately I need anaconda software to run this command

Related

Other conda environments do not automatically activate in VScode git bash

I'm not really understanding what's happening with git bash and scripts in general. I'm just following a data science course and I'm trying to setup my environment nicely.
I first downloaded Anaconda3 and git bash. I'm also using git bash as my default terminal in VSCode.
I have 2 issues that are happening that are kinda of annoying.
When I start VS code, terminal (git bash) opens by default but does NOT activate conda. However, when I open a new terminal then it'll automatically "conda activate". I'm confused why it doesn't run it by default and I'm also confused why it runs it automatically when I open a new terminal session.
My other issue is that when I created a new conda environment called "pandas", for some reason this breaks that script that automatically activates the environment. As in that scripts works perfectly when I'm using the default conda interpreter "base" but if I change it, it'll just give me this error message when I open a new terminal.
C:\ProgramData\Anaconda3\Scripts\activate pandas
bash: C:ProgramDataAnaconda3Scriptsactivate: command not found
if I manually type in "conda activate pandas" it'll work.

import tensorflow working in terminal but not in jupyter notebook

I used the following guide to install tensorflow-gpu - https://towardsdatascience.com/tensorflow-gpu-installation-made-easy-use-conda-instead-of-pip-52e5249374bc
I created a new environment and installed tensorflow-gpu using the command -
conda create --name tf_gpu tensorflow-gpu
If I activate the environment, start python in terminal, and import tensorflow from the terminal, it works.
BUT
When I activate the environment, run a jupyter notebook and type -
import tensorflow
I get module not found error. How do I resolve this?
Start Command Promt (CMD) as administrator (right click). Do not enter any environment yet.
Install Jupyter (and nb_conda as well as ipykernel) to get your environments listed: conda install jupyter nb_conda ipykernel
Activate the environment you want to add to jupyter kernel: conda activate myenv
Install ipykernel in the environment (do this for all envvironemnts you would like to add): conda install ipykernel
To start Jupyter, cd to root (cd .. until you are at C:) then type (does not need to be inside and env): Jupyter noteboook
You might need to confirm that it shall open in a web browser (I use chrome)
Once open in a browser navigate to the folder of your choice, then make a new python 3 file.
Once inside click Kernel -> Change kernel and select the conda env you would like
You should now be able to change kernel (env) within all conda environments that have ipykernel installed (step 4)

How do you install a module in spyder anaconda?

I'm trying to run some code in Spyder Anaconda. I thought it would be as simple as importing it as seen in the code but I get an error message:
ModuleNotFoundError: No module named 'image_registration'
I know this means that image_registration isn't included in what Spyder already has but I cant quite figure out how to add it.
from image_registration import chi2_shift
from image_registration.fft_tools import shift
Add your Anaconda Scripts path (Default=C:\Users\userna**\Anaconda3\Scripts) to Environment Variables and open your command prompt and type
pip.exe install module_nameIn your case pip.exe install image_registration To install module image Registration
Please tryout the below steps in anaconda prompt
1. conda create -n myenv
2. activate myenv
3. pip install image_registration
4. conda install spyder
5. spyder
If you have already installed image_registration package in an environment you can activate that environment and try to open spyder from the activated environment.

Unable to create process because python.exe & pythonw.exe under Conda environment MISSING/GONE

From [Anaconda installer archive], I install Anaconda3-4.2.0-Windows-x86_64.exe, I open a conda prompt. I create conda environment.
conda create -n keras_tensorflow_2 python=3.5
Activate it.
activate keras_tensorflow_2
Install Theano, Tensorflow & Keras.
conda install theano
pip install --ignore-installed --upgrade tensorflow
pip install keras
*Although here, theano is successfully installed but does not work. But that's a different matter.
Run python & test for tensorflow inside the conda prompt.
python
import tensorflow
No error. It works.
So now I want to open using Spyder.
If I directly open Spyder, and import tensorflow inside the IPython, error shows:
ImportError: No module named tensorflow
So what I did that work is
Open Anaconda Navigator
Anaconda Navigator>Environments. Click keras_tensorflow_2 environment. [Pic_1]
Anaconda Navigator>Home. At dropdown menu for "Applications on", choose tensorflow_2. Install Spyder. [Pic_2]
Then, open Spyder from Start Menu. Windows Security Alert pop up. Click Allow access. [Pic_3] . Test tensorflow, still not working.
So have to go back to Conda Prompt. Type
activate tensorflow_2
spyder
Conda prompt will automatically close and Spyder will automatically open. Import Tensorflow. Finally WORKS!
Up until this point, the folder Anaconda3>envs>tensorflow_2 still has python.exe and pythonw.exe as show here [Pic_4].
HOWEVER, once I close/restart Spyder, the folder Anaconda3>envs>tensorflow_2automatically has MISSING python.exe and pythonw.exe. [Pic_5] I don't know why this would happen. So I can no longer use this environment. When I tried to 'Open with IPython' through anaconda navigator [Pic_1], error:
Unable to create process using
'C:\Anaconda3\envs\keras_tensorflow_2\python.exe
C:\Anaconda3\envs\keras_tensorflow_2\Scripts\ipython-script.py -i'
And every time I want to use Tensorflow, I have to recreate the environment. Any advice please? Thank you.
All pictures available here: https://drive.google.com/open?id=0B6eS8bjSwwBLSzFRTFVHdG9zTTA
I found a way around it. Python.exe and Pythonw.exe still missing. Maybe it actually doesn't matter them being missing. I don't know.
Anyway, when inside conda prompt, if I navigate to my specific environment's Script, activate the environment and then run Spyder from there, it will work.
cd C:\Anaconda3\envs\keras_tensorflow_2\Scripts
activate keras_tensorflow_2
spyder
Reference: How to ensure that Spyder runs within a conda environment?

ImportError:libcudart.so.8.0:cannot open shared object file:No such file or directory

I used the spyder or terminal to run the mnist_deep.py program , it can run normally, but when i run the program using pycharm, it will cause an error.The Project Interpreter is 2.7.12(~/anaconda2/bin/python).
Error Type:
ImportError:libcudart.so.8.0:cannot open shared object file:No such file or directory
Error importing tensorflow.Unless you are using bazel,you should not try to import tensorflow from its source directory;please exit the tensorflow source tree,and relaunch your python interpreter from there
It's preferable to do a system-wide configuration instead of editing ~/.bashrc. Create a .conf file in /etc/ld.so.conf.d/:
sudo nano /etc/ld.so.conf.d/nvidia.conf
Add this:
/usr/local/cuda-8.0/lib64
/usr/local/cuda-8.0/lib # you probably don't need this line; check
# if the directory exists
Then run sudo ldconfig. Hope this brings you joy.
In my case, I had installed tensorflow-gpu on a machine without a GPU.
Uninstalling it fixed the problem
pip uninstall tensorflow-gpu
pip install tensorflow --ignore-installed
Without the 2nd step, I was getting an error No module named tensorflow (ref)