TensorFlow
Installation
Install TensorFlow with conda
1. Install the Python development environment on your system
Check if your Python environment is already configured:
Requires Python 3.6–3.8, pip and venv >= 19.0
2. Create a virtual environment (recommended)
Show all envs:
1 | conda info --envs |
Remove env
1 | conda env remove --name tf |
Add tf kernel to Jupyter
How to add conda environment to jupyter lab
How to add your Conda environment to your jupyter notebook in just 4 steps
Step 1: Create a Conda environment.
1 | (base) ➜ ~ conda create --name tf |
Step 2: Activate the environment using the command as shown in the console. After you activate it, you can install any package you need in this environment.
For example, I am going to install Tensorflow in this environment. The command to do so,
1 | (base) ➜ ~ conda activate tf |
Step 3: Now you have successfully installed Tensorflow. Congratulations!!
Now comes the step to set this conda environment on your jupyter notebook, to do so please install ipykernel.
1 | (tf) ➜ ~ conda install -c anaconda ipykernel |
After installing this,
just type,
1 | (tf) ➜ ~ python -m ipykernel install --user --name=tf |
Step 4: Just check your Jupyter Notebook, to see the shining tf.
OPTIONAL: Install other Data Science Packages from previous env
NOT work for the migration from higher version of Python to lower version of Python
Assume your previous env is base
1 | (tf) ➜ ~ conda activate base |
EXPORT current env
``sh CLI
(base) ➜ conda list –export > /tmp/base.yml
1 |
|
1 | (tf) ➜ ~ conda env update --file /tmp/base.yml |
Since base
is Python 3.8.8, and tf
is Python 3.7.7. There must be some errors. But the rest packages should work well.
Step 5: Install the missing packages in tf
Install needed packages manually
For example, I need to install package pandas
and plotly
.
For plotly
installation, visit https://zacks.one/python-plotly/
1 | (tf) ➜ ~ conda install pandas -y |