要在远程 Ubuntu 服务器上使用 Conda 创建一个特定版本的 Python 环境(例如 Python 3.10.12),并通过 VS Code 进行远程开发,您可以按照以下步骤操作:
打开远程服务器的终端:
如果您已经在服务器上,直接打开终端。如果您是通过 SSH 连接到服务器的,首先登录到服务器。
创建新的 Conda 环境:
使用 Conda 创建一个新环境,并指定 Python 版本为 3.10.12。您可以给环境指定一个名字,比如 myenv
:
conda create -n myenv python=3.10.12
激活新环境:
创建环境后,激活该环境:
conda activate myenv
安装所需的 Python 包:
在您的新环境中安装任何所需的包。例如,安装 NumPy 和 Pandas:
conda install numpy pandas
确保安装了 Remote - SSH 扩展:
如果您还没有在 VS Code 上安装 Remote - SSH 扩展,请安装它。
通过 VS Code 连接到远程服务器:
使用 Remote - SSH 扩展连接到您的远程服务器。
在远程服务器上打开 VS Code 终端:
连接后,在 VS Code 中打开一个新的终端。这个终端将连接到您的远程服务器。
在 VS Code 中激活 Conda 环境:
在 VS Code 终端中,激活您刚刚创建的 Conda 环境:
conda activate myenv
配置 VS Code 使用正确的 Python 解释器:
Ctrl+Shift+P
或 Cmd+Shift+P
)。开始编写 Python 代码:
现在,您可以开始在远程服务器上的 VS Code 中编写 Python 代码了。
pip install
或 conda install
安装这些依赖。(base) sh@sh:~$ conda create -n aienv python=3.10.12
Collecting package metadata (current_repodata.json): done
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: done
==> WARNING: A newer version of conda exists. <==
current version: 4.9.2
latest version: 23.11.0
Please update conda by running
$ conda update -n base -c defaults conda
## Package Plan ##
environment location: /home/sh/miniconda3/envs/aienv
added / updated specs:
- python=3.10.12
The following packages will be downloaded:
package | build
---------------------------|-----------------
_openmp_mutex-5.1 | 1_gnu 21 KB
bzip2-1.0.8 | h7b6447c_0 78 KB
ca-certificates-2023.12.12 | h06a4308_0 126 KB
ld_impl_linux-64-2.38 | h1181459_1 654 KB
libffi-3.4.4 | h6a678d5_0 142 KB
libgcc-ng-11.2.0 | h1234567_1 5.3 MB
libgomp-11.2.0 | h1234567_1 474 KB
libstdcxx-ng-11.2.0 | h1234567_1 4.7 MB
libuuid-1.41.5 | h5eee18b_0 27 KB
ncurses-6.4 | h6a678d5_0 914 KB
openssl-3.0.12 | h7f8727e_0 5.2 MB
pip-23.3.1 | py310h06a4308_0 2.7 MB
python-3.10.12 | h955ad1f_0 26.8 MB
readline-8.2 | h5eee18b_0 357 KB
setuptools-68.2.2 | py310h06a4308_0 957 KB
sqlite-3.41.2 | h5eee18b_0 1.2 MB
tk-8.6.12 | h1ccaba5_0 3.0 MB
tzdata-2023c | h04d1e81_0 116 KB
wheel-0.41.2 | py310h06a4308_0 109 KB
xz-5.4.5 | h5eee18b_0 646 KB
zlib-1.2.13 | h5eee18b_0 103 KB
------------------------------------------------------------
Total: 53.5 MB
The following NEW packages will be INSTALLED:
_libgcc_mutex pkgs/main/linux-64::_libgcc_mutex-0.1-main
_openmp_mutex pkgs/main/linux-64::_openmp_mutex-5.1-1_gnu
bzip2 pkgs/main/linux-64::bzip2-1.0.8-h7b6447c_0
ca-certificates pkgs/main/linux-64::ca-certificates-2023.12.12-h06a4308_0
ld_impl_linux-64 pkgs/main/linux-64::ld_impl_linux-64-2.38-h1181459_1
libffi pkgs/main/linux-64::libffi-3.4.4-h6a678d5_0
libgcc-ng pkgs/main/linux-64::libgcc-ng-11.2.0-h1234567_1
libgomp pkgs/main/linux-64::libgomp-11.2.0-h1234567_1
libstdcxx-ng pkgs/main/linux-64::libstdcxx-ng-11.2.0-h1234567_1
libuuid pkgs/main/linux-64::libuuid-1.41.5-h5eee18b_0
ncurses pkgs/main/linux-64::ncurses-6.4-h6a678d5_0
openssl pkgs/main/linux-64::openssl-3.0.12-h7f8727e_0
pip pkgs/main/linux-64::pip-23.3.1-py310h06a4308_0
python pkgs/main/linux-64::python-3.10.12-h955ad1f_0
readline pkgs/main/linux-64::readline-8.2-h5eee18b_0
setuptools pkgs/main/linux-64::setuptools-68.2.2-py310h06a4308_0
sqlite pkgs/main/linux-64::sqlite-3.41.2-h5eee18b_0
tk pkgs/main/linux-64::tk-8.6.12-h1ccaba5_0
tzdata pkgs/main/noarch::tzdata-2023c-h04d1e81_0
wheel pkgs/main/linux-64::wheel-0.41.2-py310h06a4308_0
xz pkgs/main/linux-64::xz-5.4.5-h5eee18b_0
zlib pkgs/main/linux-64::zlib-1.2.13-h5eee18b_0
Proceed ([y]/n)? y
Downloading and Extracting Packages
libuuid-1.41.5 | 27 KB | #################################################################################################################################################### | 100%
pip-23.3.1 | 2.7 MB | #################################################################################################################################################### | 100%
ncurses-6.4 | 914 KB | #################################################################################################################################################### | 100%
libffi-3.4.4 | 142 KB | #################################################################################################################################################### | 100%
ld_impl_linux-64-2.3 | 654 KB | #################################################################################################################################################### | 100%
readline-8.2 | 357 KB | #################################################################################################################################################### | 100%
tk-8.6.12 | 3.0 MB | #################################################################################################################################################### | 100%
tzdata-2023c | 116 KB | #################################################################################################################################################### | 100%
python-3.10.12 | 26.8 MB | #################################################################################################################################################### | 100%
setuptools-68.2.2 | 957 KB | #################################################################################################################################################### | 100%
ca-certificates-2023 | 126 KB | #################################################################################################################################################### | 100%
openssl-3.0.12 | 5.2 MB | #################################################################################################################################################### | 100%
libgcc-ng-11.2.0 | 5.3 MB | #################################################################################################################################################### | 100%
zlib-1.2.13 | 103 KB | #################################################################################################################################################### | 100%
xz-5.4.5 | 646 KB | #################################################################################################################################################### | 100%
wheel-0.41.2 | 109 KB | #################################################################################################################################################### | 100%
libstdcxx-ng-11.2.0 | 4.7 MB | #################################################################################################################################################### | 100%
sqlite-3.41.2 | 1.2 MB | #################################################################################################################################################### | 100%
bzip2-1.0.8 | 78 KB | #################################################################################################################################################### | 100%
libgomp-11.2.0 | 474 KB | #################################################################################################################################################### | 100%
_openmp_mutex-5.1 | 21 KB | #################################################################################################################################################### | 100%
Preparing transaction: done
Verifying transaction: done
Executing transaction: done
#
# To activate this environment, use
#
# $ conda activate aienv
#
# To deactivate an active environment, use
#
# $ conda deactivate
(base) sh@sh:~$ conda activate aienv
(aienv) sh@sh:~$
(aienv) sh@sh:~$
(aienv) sh@sh:~/sunyuhua$ cd langchain-chatchat/
(aienv) sh@sh:~/sunyuhua/langchain-chatchat$ pip install -r requirements.txt
Ignoring python-magic-bin: markers 'sys_platform == "win32"' don't match your environment
Collecting langchain==0.0.344 (from -r requirements.txt (line 3))
Downloading langchain-0.0.344-py3-none-any.whl.metadata (16 kB)
Collecting langchain-experimental>=0.0.42 (from -r requirements.txt (line 4))
Downloading langchain_experimental-0.0.47-py3-none-any.whl.metadata (1.9 kB)
Collecting pydantic==1.10.13 (from -r requirements.txt (line 5))
Downloading pydantic-1.10.13-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (149 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 149.6/149.6 kB 612.1 kB/s eta 0:00:00
Collecting fschat>=0.2.33 (from -r requirements.txt (line 6))
Downloading fschat-0.2.34-py3-none-any.whl.metadata (20 kB)
Collecting xformers>=0.0.22.post7 (from -r requirements.txt (line 7))
Downloading xformers-0.0.23.post1-cp310-cp310-manylinux2014_x86_64.whl.metadata (1.0 kB)
Collecting openai>=1.3.6 (from -r requirements.txt (line 8))
Downloading openai-1.6.1-py3-none-any.whl.metadata (17 kB)
Collecting sentence_transformers (from -r requirements.txt (line 9))
Downloading sentence-transformers-2.2.2.tar.gz (85 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 86.0/86.0 kB 3.8 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting transformers>=4.35.2 (from -r requirements.txt (line 10))
Downloading transformers-4.36.2-py3-none-any.whl.metadata (126 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 126.8/126.8 kB 4.0 MB/s eta 0:00:00
Collecting torch==2.1.0 (from -r requirements.txt (line 11))
Downloading torch-2.1.0-cp310-cp310-manylinux1_x86_64.whl.metadata (25 kB)
Collecting torchvision (from -r requirements.txt (line 12))
Downloading torchvision-0.16.2-cp310-cp310-manylinux1_x86_64.whl.metadata (6.6 kB)
Collecting torchaudio (from -r requirements.txt (line 13))
Downloading torchaudio-2.1.2-cp310-cp310-manylinux1_x86_64.whl.metadata (6.4 kB)
Collecting fastapi>=0.104 (from -r requirements.txt (line 14))
Downloading fastapi-0.108.0-py3-none-any.whl.metadata (24 kB)
Collecting nltk>=3.8.1 (from -r requirements.txt (line 15))
Downloading nltk-3.8.1-py3-none-any.whl (1.5 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.5/1.5 MB 3.8 MB/s eta 0:00:00
Collecting uvicorn>=0.24.0.post1 (from -r requirements.txt (line 16))
Downloading uvicorn-0.25.0-py3-none-any.whl.metadata (6.4 kB)
Collecting starlette~=0.27.0 (from -r requirements.txt (line 17))
Downloading starlette-0.27.0-py3-none-any.whl.metadata (5.8 kB)
Collecting unstructured==0.11.0 (from unstructured[all-docs]==0.11.0->-r requirements.txt (line 18))
Downloading unstructured-0.11.0-py3-none-any.whl.metadata (25 kB)
Collecting SQLAlchemy==2.0.19 (from -r requirements.txt (line 20))
Downloading SQLAlchemy-2.0.19-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (9.4 kB)
Collecting faiss-cpu (from -r requirements.txt (line 21))
Downloading faiss_cpu-1.7.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.6/17.6 MB 5.3 MB/s eta 0:00:00
Collecting accelerate>=0.24.1 (from -r requirements.txt (line 22))
Downloading accelerate-0.25.0-py3-none-any.whl.metadata (18 kB)
Collecting spacy>=3.7.2 (from -r requirements.txt (line 23))
Downloading spacy-3.7.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (25 kB)
Collecting PyMuPDF (from -r requirements.txt (line 24))
Downloading PyMuPDF-1.23.8-cp310-none-manylinux2014_x86_64.whl.metadata (3.4 kB)
Collecting rapidocr_onnxruntime (from -r requirements.txt (line 25))
Downloading rapidocr_onnxruntime-1.3.9-py3-none-any.whl.metadata (1.3 kB)
Collecting requests>=2.31.0 (from -r requirements.txt (line 26))
Downloading requests-2.31.0-py3-none-any.whl.metadata (4.6 kB)
Collecting pathlib>=1.0.1 (from -r requirements.txt (line 27))
Downloading pathlib-1.0.1-py3-none-any.whl (14 kB)
Collecting pytest>=7.4.3 (from -r requirements.txt (line 28))
Downloading pytest-7.4.3-py3-none-any.whl.metadata (7.9 kB)
Collecting numexpr>=2.8.7 (from -r requirements.txt (line 29))
Downloading numexpr-2.8.8-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.9 kB)
Collecting strsimpy>=0.2.1 (from -r requirements.txt (line 30))
Downloading strsimpy-0.2.1-py3-none-any.whl (45 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 45.9/45.9 kB 37.3 kB/s eta 0:00:00
Collecting markdownify>=0.11.6 (from -r requirements.txt (line 31))
Downloading markdownify-0.11.6-py3-none-any.whl (16 kB)
Collecting tiktoken>=0.5.1 (from -r requirements.txt (line 32))
Downloading tiktoken-0.5.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)
Collecting tqdm>=4.66.1 (from -r requirements.txt (line 33))
Downloading tqdm-4.66.1-py3-none-any.whl.metadata (57 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.6/57.6 kB 5.6 MB/s eta 0:00:00
Collecting websockets (from -r requirements.txt (line 34))
Downloading websockets-12.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (6.6 kB)
Collecting numpy~=1.24.4 (from -r requirements.txt (line 35))
Downloading numpy-1.24.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (5.6 kB)
Collecting pandas~=2.0.3 (from -r requirements.txt (line 36))
Downloading pandas-2.0.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (18 kB)
Collecting einops>=0.7.0 (from -r requirements.txt (line 37))
Downloading einops-0.7.0-py3-none-any.whl.metadata (13 kB)
Collecting transformers_stream_generator==0.0.4 (from -r requirements.txt (line 38))
Downloading transformers-stream-generator-0.0.4.tar.gz (12 kB)
Preparing metadata (setup.py) ... done
Collecting vllm==0.2.2 (from -r requirements.txt (line 39))
Downloading vllm-0.2.2-cp310-cp310-manylinux1_x86_64.whl.metadata (6.4 kB)
Collecting arxiv>=2.0.0 (from -r requirements.txt (line 54))
Downloading arxiv-2.1.0-py3-none-any.whl.metadata (6.1 kB)
Collecting youtube-search>=2.1.2 (from -r requirements.txt (line 55))
Downloading youtube_search-2.1.2-py3-none-any.whl (3.4 kB)
Collecting duckduckgo-search>=3.9.9 (from -r requirements.txt (line 56))
Downloading duckduckgo_search-4.1.1-py3-none-any.whl.metadata (19 kB)
Collecting metaphor-python>=0.1.23 (from -r requirements.txt (line 57))
Downloading metaphor_python-0.1.23-py3-none-any.whl.metadata (636 bytes)
Collecting streamlit>=1.29.0 (from -r requirements.txt (line 61))
Downloading streamlit-1.29.0-py2.py3-none-any.whl.metadata (8.2 kB)
Collecting streamlit-option-menu>=0.3.6 (from -r requirements.txt (line 62))
Downloading streamlit_option_menu-0.3.6-py3-none-any.whl.metadata (2.5 kB)
Collecting streamlit-antd-components>=0.2.3 (from -r requirements.txt (line 63))
Downloading streamlit_antd_components-0.2.5-py3-none-any.whl.metadata (3.3 kB)
Collecting streamlit-chatbox>=1.1.11 (from -r requirements.txt (line 64))
Downloading streamlit_chatbox-1.1.11-py3-none-any.whl.metadata (6.4 kB)
Collecting streamlit-modal>=0.1.0 (from -r requirements.txt (line 65))
Downloading streamlit_modal-0.1.0.tar.gz (3.9 kB)
Preparing metadata (setup.py) ... done
Collecting streamlit-aggrid>=0.3.4.post3 (from -r requirements.txt (line 66))
Downloading streamlit_aggrid-0.3.4.post3-py3-none-any.whl (3.4 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 3.4/3.4 MB 4.2 MB/s eta 0:00:00
Collecting httpx>=0.25.2 (from httpx[brotli,http2,socks]>=0.25.2->-r requirements.txt (line 67))
Downloading httpx-0.26.0-py3-none-any.whl.metadata (7.6 kB)
Collecting watchdog>=3.0.0 (from -r requirements.txt (line 68))
Downloading watchdog-3.0.0-py3-none-manylinux2014_x86_64.whl (82 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 82.1/82.1 kB 6.3 MB/s eta 0:00:00
Collecting PyYAML>=5.3 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading PyYAML-6.0.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (2.1 kB)
Collecting aiohttp<4.0.0,>=3.8.3 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading aiohttp-3.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (7.4 kB)
Collecting anyio<4.0 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading anyio-3.7.1-py3-none-any.whl.metadata (4.7 kB)
Collecting async-timeout<5.0.0,>=4.0.0 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading async_timeout-4.0.3-py3-none-any.whl.metadata (4.2 kB)
Collecting dataclasses-json<0.7,>=0.5.7 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading dataclasses_json-0.6.3-py3-none-any.whl.metadata (25 kB)
Collecting jsonpatch<2.0,>=1.33 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading jsonpatch-1.33-py2.py3-none-any.whl.metadata (3.0 kB)
Collecting langchain-core<0.1,>=0.0.8 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading langchain_core-0.0.13-py3-none-any.whl.metadata (978 bytes)
Collecting langsmith<0.1.0,>=0.0.63 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading langsmith-0.0.75-py3-none-any.whl.metadata (10 kB)
Collecting tenacity<9.0.0,>=8.1.0 (from langchain==0.0.344->-r requirements.txt (line 3))
Downloading tenacity-8.2.3-py3-none-any.whl.metadata (1.0 kB)
Collecting typing-extensions>=4.2.0 (from pydantic==1.10.13->-r requirements.txt (line 5))
Downloading typing_extensions-4.9.0-py3-none-any.whl.metadata (3.0 kB)
Collecting filelock (from torch==2.1.0->-r requirements.txt (line 11))
Downloading filelock-3.13.1-py3-none-any.whl.metadata (2.8 kB)
Collecting sympy (from torch==2.1.0->-r requirements.txt (line 11))
Downloading sympy-1.12-py3-none-any.whl (5.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 5.7/5.7 MB 3.0 MB/s eta 0:00:00
Collecting networkx (from torch==2.1.0->-r requirements.txt (line 11))
Downloading networkx-3.2.1-py3-none-any.whl.metadata (5.2 kB)
Collecting jinja2 (from torch==2.1.0->-r requirements.txt (line 11))
Downloading Jinja2-3.1.2-py3-none-any.whl (133 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 133.1/133.1 kB 3.0 MB/s eta 0:00:00
Collecting fsspec (from torch==2.1.0->-r requirements.txt (line 11))
Downloading fsspec-2023.12.2-py3-none-any.whl.metadata (6.8 kB)
Collecting nvidia-cuda-nvrtc-cu12==12.1.105 (from torch==2.1.0->-r requirements.txt (line 11))
Downloading nvidia_cuda_nvrtc_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (23.7 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 23.7/23.7 MB 2.9 MB/s eta 0:00:00
Collecting nvidia-cuda-runtime-cu12==12.1.105 (from torch==2.1.0->-r requirements.txt (line 11))
Downloading nvidia_cuda_runtime_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (823 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 823.6/823.6 kB 3.3 MB/s eta 0:00:00
Collecting nvidia-cuda-cupti-cu12==12.1.105 (from torch==2.1.0->-r requirements.txt (line 11))
Downloading nvidia_cuda_cupti_cu12-12.1.105-py3-none-manylinux1_x86_64.whl (14.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 14.1/14.1 MB 4.2 MB/s eta 0:00:00
Collecting nvidia-cudnn-cu12==8.9.2.26 (from torch==2.1.0->-r requirements.txt (line 11))
Downloading nvidia_cudnn_cu12-8.9.2.26-py3-none-manylinux1_x86_64.whl.metadata (1.6 kB)
Collecting nvidia-cublas-cu12==12.1.3.1 (from torch==2.1.0->-r requirements.txt (line 11))
Downloading nvidia_cublas_cu12-12.1.3.1-py3-none-manylinux1_x86_64.whl (410.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━?━━━━━━━━━━━━━━━ 249.1/410.6 MB 2.3 MB/s eta 0:01:10