File size: 3,857 Bytes
927854c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# Anaconda Environment Setup Guide
## Quick Start
### 1. Create Conda Environment
```bash
# Create environment from environment.yml
conda env create -f environment.yml
# OR create manually
conda create -n research-ai-assistant python=3.10
conda activate research-ai-assistant
```
### 2. Activate Environment
```bash
# Windows
conda activate research-ai-assistant
# Linux/Mac
source activate research-ai-assistant
# OR
conda activate research-ai-assistant
```
### 3. Install Dependencies
```bash
# Install from requirements.txt
pip install -r requirements.txt
# OR install openai package directly
pip install openai>=1.0.0
```
### 4. Set Environment Variables
```bash
# Windows (PowerShell)
$env:NOVITA_API_KEY="your_api_key_here"
$env:NOVITA_BASE_URL="https://api.novita.ai/dedicated/v1/openai"
$env:NOVITA_MODEL="deepseek-ai/DeepSeek-R1-Distill-Qwen-7B:de-1a706eeafbf3ebc2"
# Windows (CMD)
set NOVITA_API_KEY=your_api_key_here
set NOVITA_BASE_URL=https://api.novita.ai/dedicated/v1/openai
set NOVITA_MODEL=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B:de-1a706eeafbf3ebc2
# Linux/Mac
export NOVITA_API_KEY=your_api_key_here
export NOVITA_BASE_URL=https://api.novita.ai/dedicated/v1/openai
export NOVITA_MODEL=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B:de-1a706eeafbf3ebc2
```
### 5. Test Connection
```bash
# Run the test script
python test_novita_connection.py
# OR use the batch script (Windows)
test_novita_conda.bat
```
## Using Anaconda Prompt (Windows)
1. **Open Anaconda Prompt** (search for "Anaconda Prompt" in Start menu)
2. **Navigate to project directory:**
```bash
cd C:\Users\85jat\GenAI_work_V2\Prototyping\Research_AI_Assistant_V2\Research_AI_Assistant_API
```
3. **Create/activate environment:**
```bash
conda env create -f environment.yml
conda activate research-ai-assistant
```
4. **Install dependencies:**
```bash
pip install -r requirements.txt
```
5. **Set environment variables:**
```bash
set NOVITA_API_KEY=your_api_key_here
set NOVITA_BASE_URL=https://api.novita.ai/dedicated/v1/openai
set NOVITA_MODEL=deepseek-ai/DeepSeek-R1-Distill-Qwen-7B:de-1a706eeafbf3ebc2
```
6. **Run test:**
```bash
python test_novita_connection.py
```
## Environment Management
### List environments
```bash
conda env list
```
### Activate environment
```bash
conda activate research-ai-assistant
```
### Deactivate environment
```bash
conda deactivate
```
### Remove environment (if needed)
```bash
conda env remove -n research-ai-assistant
```
### Update environment
```bash
conda env update -f environment.yml --prune
```
## Verification
After setup, verify everything works:
```bash
# Activate environment
conda activate research-ai-assistant
# Check Python
python --version
# Check openai package
python -c "import openai; print(openai.__version__)"
# Check configuration
python -c "from src.config import get_settings; s = get_settings(); print(f'API Key: {s.novita_api_key[:10]}...' if s.novita_api_key else 'API Key: NOT SET')"
# Run full test
python test_novita_connection.py
```
## Troubleshooting
### Conda command not found
- **Windows:** Open Anaconda Prompt instead of regular PowerShell/CMD
- **Linux/Mac:** Ensure conda is initialized: `conda init bash` or `conda init zsh`
### Environment activation fails
- Try: `conda activate base` first, then `conda activate research-ai-assistant`
- On Windows: Use Anaconda Prompt instead of regular terminal
### Package installation fails
- Update conda: `conda update conda`
- Update pip: `pip install --upgrade pip`
- Try installing from conda-forge: `conda install -c conda-forge openai`
### Import errors
- Ensure environment is activated: `conda activate research-ai-assistant`
- Verify package is installed: `pip list | grep openai`
- Reinstall if needed: `pip install --force-reinstall openai>=1.0.0`
|