private-gpt
private-gpt copied to clipboard
Ubuntu 18.04 install
Did an install on a Ubuntu 18.04 install (I want to ditch Ubuntu but never get around to decide what to choose so stuck hah)
Posting in case someone else want to try similar; my process was as follows:
1. Python version
Py >= 3.10 is required for chromadb
and likely others.
# REQUIRED for chromadb=0.3.22
sudo add-apt-repository ppa:deadsnakes/ppa
sudp apt-get install python3.11
sudp apt-get install python3.11-venv
sudp apt-get install python3.11-tk # extra thing for any tk things
sudp apt-get install python3.11-dev
2. CPP
Ubuntu has 18.04 have 7.5.0 as "latest". Not sure what version is needed but suspect 11.
This is to get to install llma-cpp-python
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get install gcc-11
Setting up alternatives: I had 7.5.0 as default, these were linked as gcc-7, g++-7 etc. Add as alternative (see: https://man7.org/linux/man-pages/man1/update-alternatives.1.html):
7.5.0
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-7 750 \
--slave /usr/bin/g++ g++ /usr/bin/g++-7 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-7 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-7 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-7
sudo update-alternatives \
--install /usr/bin/cpp cpp /usr/bin/cpp-7 750
Add v11 as alternative:
# v11.1.0
sudo update-alternatives \
--install /usr/bin/gcc gcc /usr/bin/gcc-11 111 \
--slave /usr/bin/g++ g++ /usr/bin/g++-11 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-11 \
--slave /usr/bin/gcc-ar gcc-ar /usr/bin/gcc-ar-11 \
--slave /usr/bin/gcc-ranlib gcc-ranlib /usr/bin/gcc-ranlib-11
sudo update-alternatives \
--install /usr/bin/cpp cpp /usr/bin/cpp-11 111
Then be sure v11 is active:
sudo update-alternatives --config gcc
Select version 11
3. Repository clone and prepare
Clone this repository and enter:
git clone https://github.com/imartinez/privateGPT.git
cd privateGPT/
Create a virtual environment using python 3.11 and activate:
python3.11 -m venv --prompt mg4 mg4
. mg4/bin/activate
Upgrade pip
and install wheel
:
pip install --upgrade pip
pip install wheel
4. Install
cat requirements.txt
langchain==0.0.166
pygpt4all==1.1.0
chromadb==0.3.22
llama-cpp-python==0.1.48
urllib3==1.26.6
pdfminer.six==20221105
One can of course use pip install -r requirements.txt
, but like to do one by one in case of errors:
pip install langchain==0.0.166
pip install pygpt4all==1.1.0
pip install chromadb==0.3.22
pip install llama-cpp-python==0.1.48
pip install urllib3==1.26.6
pip install pdfminer.six==20221105
Reset gcc:
sudo update-alternatives --config gcc
# Select version xx (option 0)
Get the models:
mkdir models && cd models
curl -LO https://gpt4all.io/models/ggml-gpt4all-j-v1.3-groovy.bin
curl -LO https://huggingface.co/Pi3141/alpaca-native-7B-ggml/resolve/397e872bf4c83f4c642317a5bf65ce84a105786e/ggml-model-q4_0.bin
cd ..
5. Testing:
I'd like to have db
as db001
m db002
ect. – or obviously more descriptive names - so (by only change):
sed 's/=db$/=db001/' example.venv >.venv
Build:
python ingest.py
Run:
python privateGPT.py
> Question:
Have fun!
how about Linux mint?
You could write this into a md
file so we could add os specific instructions to the repo :)
I've had an error that install doesn't work, and which g++
didn't work.
I had g++-11 so I made a symlink from g++ to g++-11 and it worked!
Building wheel for llama-cpp-python (pyproject.toml) ... error error: subprocess-exited-with-error
× Building wheel for llama-cpp-python (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [92 lines of output]
--------------------------------------------------------------------------------
-- Trying 'Ninja' generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:4 (ENABLE_LANGUAGE):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying 'Ninja' generator - failure
--------------------------------------------------------------------------------
--------------------------------------------------------------------------------
-- Trying 'Unix Makefiles' generator
--------------------------------
---------------------------
----------------------
-----------------
------------
-------
--
Not searching for unused variables given on the command line.
-- The C compiler identification is GNU 11.1.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- The CXX compiler identification is unknown
CMake Error at CMakeLists.txt:4 (ENABLE_LANGUAGE):
No CMAKE_CXX_COMPILER could be found.
Tell CMake where to find the compiler by setting either the environment
variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path
to the compiler, or to the compiler name if it is in the PATH.
-- Configuring incomplete, errors occurred!
--
-------
------------
-----------------
----------------------
---------------------------
--------------------------------
-- Trying 'Unix Makefiles' generator - failure
--------------------------------------------------------------------------------
********************************************************************************
scikit-build could not get a working generator for your system. Aborting build.
Building Linux wheels for Python 3.11 requires a compiler (e.g gcc).
But scikit-build does *NOT* know how to install it on ubuntu
To build compliant wheels, consider using the manylinux system described in PEP-513.
Get it with "dockcross/manylinux-x64" docker image:
https://github.com/dockcross/dockcross#readme
For more details, please refer to scikit-build documentation:
http://scikit-build.readthedocs.io/en/latest/generators.html#linux
********************************************************************************
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for llama-cpp-python Failed to build llama-cpp-python ERROR: Could not build wheels for llama-cpp-python, which is required to install pyproject.toml-based projects
You need to set g++ and gcc. The reason for this error is that cmake cannot find the c++ editor. The editor name may be g++-11, and the version is in /usr/bin. Therefore, you need to configure the default options first and follow the cpp plate in the second step of the author. Note the specific version number
Building wheel for llama-cpp-python (pyproject.toml) ... error error: subprocess-exited-with-error
× Building wheel for llama-cpp-python (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [92 lines of output]
-------------------------------------------------------------------------------- -- Trying 'Ninja' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. -- The C compiler identification is GNU 11.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- The CXX compiler identification is unknown CMake Error at CMakeLists.txt:4 (ENABLE_LANGUAGE): No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Ninja' generator - failure -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -- Trying 'Unix Makefiles' generator -------------------------------- --------------------------- ---------------------- ----------------- ------------ ------- -- Not searching for unused variables given on the command line. -- The C compiler identification is GNU 11.1.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /usr/bin/cc - skipped -- Detecting C compile features -- Detecting C compile features - done -- The CXX compiler identification is unknown CMake Error at CMakeLists.txt:4 (ENABLE_LANGUAGE): No CMAKE_CXX_COMPILER could be found. Tell CMake where to find the compiler by setting either the environment variable "CXX" or the CMake cache entry CMAKE_CXX_COMPILER to the full path to the compiler, or to the compiler name if it is in the PATH. -- Configuring incomplete, errors occurred! -- ------- ------------ ----------------- ---------------------- --------------------------- -------------------------------- -- Trying 'Unix Makefiles' generator - failure -------------------------------------------------------------------------------- ******************************************************************************** scikit-build could not get a working generator for your system. Aborting build. Building Linux wheels for Python 3.11 requires a compiler (e.g gcc). But scikit-build does *NOT* know how to install it on ubuntu To build compliant wheels, consider using the manylinux system described in PEP-513. Get it with "dockcross/manylinux-x64" docker image: https://github.com/dockcross/dockcross#readme For more details, please refer to scikit-build documentation: http://scikit-build.readthedocs.io/en/latest/generators.html#linux ******************************************************************************** [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for llama-cpp-python Failed to build llama-cpp-python ERROR: Could not build wheels for llama-cpp-python, which is required to install pyproject.toml-based projects
this one
You could write this into a
md
file so we could add os specific instructions to the repo :)
Yes. Thought about it, but would in that case do a clean VM of 18.04 and try to note all dependencies. As 18.04 went out of support by the end of April 2023 I'm not sure how useful it would be though all considered. By all means; I'm not going to tell anyone what to run and 18.04 could be the choice for what ever reason unknown to me. I'll see if I get around to it.
https://docs.anaconda.com/free/anaconda/install/linux/
git reset --hard 5a695e9767e24778ffd725ab195bf72916e27ba5
Building wheels for collected packages: hnswlib Building wheel for hnswlib (pyproject.toml) ... error error: subprocess-exited-with-error
× Building wheel for hnswlib (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [60 lines of output]
running bdist_wheel
running build
running build_ext
creating tmp
x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/dcorwell/privateGPT/proj01/include -I/usr/include/python3.11 -c /tmp/tmp685s_qw_.cpp -o tmp/tmp685s_qw_.o -std=c++14
x86_64-linux-gnu-gcc -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/dcorwell/privateGPT/proj01/include -I/usr/include/python3.11 -c /tmp/tmpad25gjnk.cpp -o tmp/tmpad25gjnk.o -std=c++11
Traceback (most recent call last):
File "/home/dcorwell/privateGPT/proj01/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in
note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for hnswlib Failed to build hnswlib ERROR: Could not build wheels for hnswlib, which is required to install pyproject.toml-based projects
Uhm help...
sudo apt install python3-dev sudo apt-get install build-essential -y
uhm duh ...