> For the complete documentation index, see [llms.txt](https://lmdm.gitbook.io/docking/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lmdm.gitbook.io/docking/parte-1-preparacao-ambiente-windows/i-instalando-o-conda-vscode-e-jupyter.md).

# I - Instalando o CONDA, VScode e Jupyter

Este guia mostra como instalar, no **Windows**, os componentes mínimos para trabalhar com notebooks Jupyter no **Visual Studio Code** usando ambientes **Conda**.

### O que será instalado

* **Miniconda** no Windows
* **Visual Studio Code**
* Extensões **Python** e **Jupyter** no VS Code
* **ipykernel** no ambiente Conda que será usado como kernel dos notebooks

> Importante: no VS Code, a extensão Jupyter detecta **ambientes Python** mesmo quando o `ipykernel` ainda não está instalado, mas **somente o `ipykernel` é necessário para iniciar um processo Python como kernel** de um notebook. Portanto, ele precisa ser instalado no ambiente que você pretende usar. Se quiser recursos modernos de depuração em notebooks, prefira **ipykernel 6 ou superior**.

***

### 1. Instalar o Miniconda no Windows

#### Instalação por linha de comando (winget)

Abra o **PowerShell** e rode:

```powershell
winget install Anaconda.Miniconda3
```

#### Habilitar o conda no PowerShell

Abra o **Anaconda Prompt** ou **Miniconda Prompt** e rode:

```powershell
& "$Env:USERPROFILE\miniconda3\Scripts\conda.exe" init powershell
```

No Powershell, habilite a execução de scripts com:

```powershell
Set-ExecutionPolicy -Scope CurrentUser RemoteSigned -Force
```

Se você instalou o Miniconda em outro diretório, ajuste o caminho.

Depois:

1. Feche o PowerShell.
2. Abra o PowerShell novamente.
3. Teste:

```powershell
conda --version
```

***

### 2. Instalar o Visual Studio Code

#### Opção gráfica

1. Acesse o site oficial do VS Code.
2. Baixe o instalador para **Windows**.
3. Execute o instalador.
4. Prefira **User Setup** quando estiver disponível.
5. Conclua a instalação.

#### Opção por linha de comando (winget)

```powershell
winget install Microsoft.VisualStudioCode
```

Depois, feche e reabra o terminal.

#### Teste

```powershell
code --version
```

Se o comando `code` ainda não funcionar, abra o VS Code pelo menu Iniciar.

***

### 3. Instalar as extensões Python e Jupyter no VS Code

Abra o VS Code e instale estas extensões:

* **Python** (Microsoft)
* **Jupyter** (Microsoft)

Você pode fazer isso pela aba **Extensions** ou pelo terminal:

```powershell
code --install-extension ms-python.python
code --install-extension ms-toolsai.jupyter
```

OBS: O VS Code é altamente personalizável, e você pode customizá-lo da forma que melhor lhe convier&#x20;

***

### 4. Criar um ambiente Conda para notebooks

Exemplo com Python 3.11 (preferimos o 3.11 porque alguns pacotes não funcionam com python >=3.12):

```powershell
conda create -n docking python=3.11 -y
conda activate docking
```

***

### 5. Instalar o ipykernel no ambiente

Agora vamos instalar um pacote que nos permite rodar o python de forma interativa.

Ainda dentro do ambiente ativado:

```powershell
conda install ipykernel -y
```

Se quiser, você também pode instalar o pacote `jupyter`, mas para o VS Code **não é obrigatório** instalar `jupyter` dentro do ambiente apenas para que ele funcione como kernel; o **`ipykernel` é o requisito essencial**.

Um conjunto seguro e prático é:

```powershell
conda install ipykernel jupyter -y
```

:warning: <mark style="color:orange;">O pacote ipywidgets pode dar problema nesse ponto da instalação. Se for o caso, rode:</mark>

```powershell
conda install -c conda-forge ipywidgets
```

<mark style="color:orange;">E então rode o comando anterior novamente.</mark>

#### Verificação

```powershell
python -m ipykernel --version
```

***

### 6. Abrir notebook no VS Code usando esse ambiente

1. Abra uma pasta no VS Code.
2. Crie um arquivo `teste.ipynb`.
3. No canto superior direito do notebook, clique em **Select Kernel**.
4. Escolha o ambiente **Conda** que você criou. (Python evironments -> docking)

O VS Code consegue listar ambientes Python detectados e também kernels Jupyter. Quando o `ipykernel` está instalado, o ambiente pode ser usado corretamente como kernel do notebook.

***

### 7. Teste mínimo

Crie uma célula e rode:

```python
print("Olá, Jupyter no VS Code")
```

Se a célula executar normalmente, a integração está funcionando.

***

### 8. Resumo

Fluxo mínimo recomendado:

```powershell
winget install Anaconda.Miniconda3
winget install Microsoft.VisualStudioCode
code --install-extension ms-python.python
code --install-extension ms-toolsai.jupyter
conda create -n docking python=3.11 -y
conda activate docking
conda install ipykernel -y
```

***

### Observações finais

* O **VS Code** detecta ambientes Python e ambientes Conda automaticamente.
* Para **usar um ambiente como kernel de notebook**, instale **`ipykernel`** nesse ambiente.
* Para recursos modernos de depuração em notebooks, use **ipykernel 6+**.
* Se o ambiente não aparecer imediatamente no seletor de kernel, feche e reabra o VS Code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lmdm.gitbook.io/docking/parte-1-preparacao-ambiente-windows/i-instalando-o-conda-vscode-e-jupyter.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
