private-gpt icon indicating copy to clipboard operation
private-gpt copied to clipboard

Ubuntu 18.04 install

Open Nickwiz opened this issue 1 year ago • 9 comments

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 db001m 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!

Nickwiz avatar May 15 '23 07:05 Nickwiz

how about Linux mint?

ResearchForumOnline avatar May 15 '23 08:05 ResearchForumOnline

You could write this into a md file so we could add os specific instructions to the repo :)

andreakiro avatar May 15 '23 08:05 andreakiro

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!

jinmc avatar May 17 '23 00:05 jinmc

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

wentywenty avatar May 21 '23 10:05 wentywenty

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

aalfaukyapo354 avatar May 23 '23 05:05 aalfaukyapo354

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

image this one

aalfaukyapo354 avatar May 23 '23 06:05 aalfaukyapo354

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.

Nickwiz avatar May 24 '23 16:05 Nickwiz

https://docs.anaconda.com/free/anaconda/install/linux/

hqzh avatar Jun 01 '23 12:06 hqzh

git reset --hard 5a695e9767e24778ffd725ab195bf72916e27ba5

hqzh avatar Jun 02 '23 14:06 hqzh

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 main() File "/home/dcorwell/privateGPT/proj01/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/dcorwell/privateGPT/proj01/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 416, in build_wheel return self._build_with_temp_dir(['bdist_wheel'], '.whl', ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir self.run_setup() File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup exec(code, locals()) File "", line 116, in File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/init.py", line 107, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command super().run_command(command) File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/wheel/bdist_wheel.py", line 346, in run self.run_command("build") File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command self.distribution.run_command(command) File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command super().run_command(command) File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build.py", line 131, in run self.run_command(cmd_name) File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command self.distribution.run_command(command) File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1234, in run_command super().run_command(command) File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/command/build_ext.py", line 84, in run _build_ext.run(self) File "/tmp/pip-build-env-1ucsuidz/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run self.build_extensions() File "", line 103, in build_extensions File "", line 70, in cpp_flag RuntimeError: Unsupported compiler -- at least C++11 support is needed! [end of output]

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...

dcorwell avatar Jul 23 '23 10:07 dcorwell

sudo apt install python3-dev sudo apt-get install build-essential -y

uhm duh ...

dcorwell avatar Jul 23 '23 11:07 dcorwell