Skip to content

Instantly share code, notes, and snippets.

@Nov05
Last active February 25, 2024 11:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nov05/bf63ac7e0a2d0f94a635fb3858894cca to your computer and use it in GitHub Desktop.
Save Nov05/bf63ac7e0a2d0f94a635fb3858894cca to your computer and use it in GitHub Desktop.
20240211_udacity reinforcement learning unity mlagents env setup

Udacity Deep Reinforcement Learning - p1 env setup

👉 for the course projcts, Unity MLAgents - Banana Collector, etc.
👉 go to the Banana and VisualBanana notebooks
👉 go to the course repo
👉 check course curriculum


Window 11, VSCode, Minicoda, Powershell

🟢 used the following shell commands to set up the env in windows 11 + vscode + miniconda.

(drlnd) PS D:\github\udacity-deep-reinforcement-learning\python  
conda create --name drlnd python=3.6 
conda activate drlnd
cd python
conda install cuda  --channel "nvidia/label/cuda-12.1.0"
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia
pip install tensorflow==1.7.1
pip install -r requirements.txt
python -m ipykernel install --user --name=drlnd
jupyter notebook ../p1_navigation/Navigation.ipynb
jupyter notebook ../p1_navigation/Navigation_Pixels.ipynb

🟢 requirement.txt

# tensorflow==1.7.1
bleach==1.5.0
# torch==0.4.0
Pillow>=4.2.1
matplotlib
numpy>=1.11.0
pytest>=3.2.2
pyyaml
# protobuf==3.5.2
protobuf==3.6.0
grpcio==1.11.0
numpy
pandas
scipy
# ipykernel
# jupyter

▪️ protobuf<=3.10.x

❌ didn't work

conda install pytorch=0.4.1 -c pytorch
conda install tensorflow==1.7.1

▪ check your gpu info.
(drlnd) PS D:\github\udacity-deep-reinforcement-learning\python> nvidia-smi

Sun Feb 11 02:44:15 2024       
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 551.23                 Driver Version: 551.23         CUDA Version: 12.4     |
|-----------------------------------------+------------------------+----------------------+
| GPU  Name                     TCC/WDDM  | Bus-Id          Disp.A | Volatile Uncorr. ECC |
| Fan  Temp   Perf          Pwr:Usage/Cap |           Memory-Usage | GPU-Util  Compute M. |
|                                         |                        |               MIG M. |
|=========================================+========================+======================|
|   0  NVIDIA GeForce GTX 1650 Ti   WDDM  |   00000000:01:00.0 Off |                  N/A |
| N/A   45C    P8              6W /   50W |       0MiB /   4096MiB |      0%      Default |
|                                         |                        |                  N/A |
+-----------------------------------------+------------------------+----------------------+

+-----------------------------------------------------------------------------------------+
| Processes:                                                                              |
|  GPU   GI   CI        PID   Type   Process name                              GPU Memory |
|        ID   ID                                                               Usage      |
|=========================================================================================|
|  No running processes found                                                             |
+-----------------------------------------------------------------------------------------+

▪️ If you get the following error, you need to install cuda.
(drlnd) PS D:\github\udacity-deep-reinforcement-learning\python> nvcc --version

nvcc : The term 'nvcc' is not recognized as the name of a cmdlet,   
function, script file, or operable program.  

▪️ After installing cuda, you can check the cuda info.
(drlnd) PS D:\github\udacity-deep-reinforcement-learning\python> nvcc --version

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2023 NVIDIA Corporation
Built on Wed_Feb__8_05:53:42_Coordinated_Universal_Time_2023
Cuda compilation tools, release 12.1, V12.1.66
Build cuda_12.1.r12.1/compiler.32415258_0

🟢 20230906 windows 11, install cuda, pytorch, from vs code + powershell
▪️ go to the Evernote note

https://pytorch.org/get-started/locally/
🟢 choose the right pytorch version

conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia  

Unity-Technologies/ml-agents#1289
🟢 unable to import UnityEnvironment in Basics.ipynb #1289
bhaskar-gaur opened this issue on Oct 4, 2018 · 6 comments
vincentpierre commented on Oct 4, 2018
make sure that protobuf==3.6.0, I think this is where your error comes from.
ptrudzki commented on Oct 11, 2018
I had the same problem and pip install protobuf==3.6.0 worked for me

@Nov05
Copy link
Author

Nov05 commented Feb 12, 2024

Some irrelevant info:

pytorch/pytorch#14468
▪️ shivaprasad123m commented on Oct 8, 2019
Use the below link

pip3 install torch==1.2.0+cpu torchvision==0.4.0+cpu -f https://download.pytorch.org/whl/torch_stable.html  

for windows OS with configuration.
OS : Windows
Package : PIP
Language : Python 3.6
CUDA : None

https://pytorch.org/get-started/previous-versions/
▪️ Installing without CUDA

conda install pytorch=0.4.1 -c pytorch  

▪️ Linux and Windows
CUDA 12.1

conda install pytorch==2.1.0 torchvision==0.16.0 torchaudio==2.1.0 pytorch-cuda=12.1 -c pytorch -c nvidia  

https://www.tensorflow.org/install/source?hl=fr#gpu
▪️ tensorflow and cuda versions
tensorflow-2.6.0 3.6-3.9 CCG 7.3.1 Bazel 3.7.2 8.1 11.2
tensorflow-2.5.0 3.6-3.9 CCG 7.3.1 Bazel 3.7.2 8.1 11.2
tensorflow-2.4.0 3,6-3,8 CCG 7.3.1 Bazel 3.1.0 8.0 11.0

pytorch/pytorch#14468
▪️ pip install torch 0.4.0 (Windows) fails. #14468 Closed
MultiTrickFox opened this issue on Nov 28, 2018

https://forums.fast.ai/t/unofficial-pytorch-0-4-support/16285/15
▪️ pytorch 0.4.1

conda install pytorch=0.4.1=py36_cuda9.2.148_cudnn7.1.4_1  

@Nov05
Copy link
Author

Nov05 commented Feb 24, 2024

👉 python -m ipykernel install --user --name=drlnd

(drlnd) PS D:\github\udacity-deep-reinforcement-learning\python> python -m ipykernel install --user --name=drlnd
Installed kernelspec drlnd in C:\Users\guido\AppData\Roaming\jupyter\kernels\drlnd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment