sentimentAPI icon indicating copy to clipboard operation
sentimentAPI copied to clipboard

Can't run it on Ubuntu 22.04.1 LTS

Open JohnReedLOL opened this issue 3 years ago • 1 comments

Can I get some help? This is my output when I try to set up and run it:

john@john-Latitude-3310-2-in-1:~/PycharmProjects$ cd sentimentAPI2
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ ls
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ pwd
/home/john/PycharmProjects/sentimentAPI2
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo apt-get -y update
Hit:1 http://us.archive.ubuntu.com/ubuntu jammy InRelease
Get:2 http://us.archive.ubuntu.com/ubuntu jammy-updates InRelease [114 kB]
Get:3 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]
Get:4 http://us.archive.ubuntu.com/ubuntu jammy-backports InRelease [99.8 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu jammy-updates/main i386 Packages [325 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 Packages [607 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu jammy-updates/main amd64 DEP-11 Metadata [92.7 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 Packages [422 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe i386 Packages [277 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu jammy-updates/universe amd64 DEP-11 Metadata [247 kB]
Get:11 http://us.archive.ubuntu.com/ubuntu jammy-updates/multiverse amd64 DEP-11 Metadata [940 B]
Get:12 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe i386 Packages [5,200 B]
Get:13 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 Packages [6,752 B]
Get:14 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 DEP-11 Metadata [12.6 kB]
Get:15 http://us.archive.ubuntu.com/ubuntu jammy-backports/universe amd64 c-n-f Metadata [352 B]
Get:16 http://security.ubuntu.com/ubuntu jammy-security/main amd64 DEP-11 Metadata [13.0 kB]
Get:17 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 DEP-11 Metadata [12.2 kB]
Fetched 2,346 kB in 1s (1,943 kB/s)                                           
Reading package lists... Done
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo apt-get -y install git
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
git is already the newest version (1:2.34.1-1ubuntu1.4).
git set to manually installed.
The following package was automatically installed and is no longer required:
  systemd-hwe-hwdb
Use 'sudo apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 14 not upgraded.
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo apt-get -y install python-dev python-pip libblas-dev liblapack-dev libatlas-base-dev gfortran
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python2-dev:i386 python2:i386 python2-dev python2 python-dev-is-python3

E: Package 'python-dev' has no installation candidate
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo apt-get -y install python3-dev python-pip libblas-dev liblapack-dev libatlas-base-dev gfortran
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
python3-dev is already the newest version (3.10.6-1~22.04).
python3-dev set to manually installed.
The following packages were automatically installed and are no longer required:
  python3-wheel systemd-hwe-hwdb
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  gfortran-11 libatlas3-base libgfortran-11-dev python-pkg-resources
  python-setuptools
Suggested packages:
  gfortran-multilib gfortran-doc gfortran-11-multilib gfortran-11-doc
  libcoarrays-dev libatlas-doc liblapack-doc python-setuptools-doc
Recommended packages:
  python2-dev
The following packages will be REMOVED:
  python3-pip
The following NEW packages will be installed:
  gfortran gfortran-11 libatlas-base-dev libatlas3-base libblas-dev
  libgfortran-11-dev liblapack-dev python-pip python-pkg-resources
  python-setuptools
0 upgraded, 10 newly installed, 1 to remove and 14 not upgraded.
Need to get 25.4 MB of archives.
After this operation, 96.4 MB of additional disk space will be used.
Get:1 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 libgfortran-11-dev amd64 11.2.0-19ubuntu1 [842 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 gfortran-11 amd64 11.2.0-19ubuntu1 [11.2 MB]
Get:3 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 gfortran amd64 4:11.2.0-1ubuntu1 [1,182 B]
Get:4 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 libatlas3-base amd64 3.10.3-12ubuntu1 [3,340 kB]
Get:5 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 libatlas-base-dev amd64 3.10.3-12ubuntu1 [3,590 kB]
Get:6 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 libblas-dev amd64 3.10.0-2ubuntu1 [164 kB]
Get:7 http://us.archive.ubuntu.com/ubuntu jammy/main amd64 liblapack-dev amd64 3.10.0-2ubuntu1 [4,774 kB]
Get:8 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 python-pkg-resources all 44.1.1-1.2 [128 kB]
Get:9 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 python-setuptools all 44.1.1-1.2 [334 kB]
Get:10 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 python-pip all 20.3.4+dfsg-4 [1,021 kB]
Fetched 25.4 MB in 3s (9,170 kB/s) 
(Reading database ... 212625 files and directories currently installed.)
Removing python3-pip (22.0.2+dfsg-1) ...
Selecting previously unselected package libgfortran-11-dev:amd64.
(Reading database ... 211941 files and directories currently installed.)
Preparing to unpack .../0-libgfortran-11-dev_11.2.0-19ubuntu1_amd64.deb ...
Unpacking libgfortran-11-dev:amd64 (11.2.0-19ubuntu1) ...
Selecting previously unselected package gfortran-11.
Preparing to unpack .../1-gfortran-11_11.2.0-19ubuntu1_amd64.deb ...
Unpacking gfortran-11 (11.2.0-19ubuntu1) ...
Selecting previously unselected package gfortran.
Preparing to unpack .../2-gfortran_4%3a11.2.0-1ubuntu1_amd64.deb ...
Unpacking gfortran (4:11.2.0-1ubuntu1) ...
Selecting previously unselected package libatlas3-base:amd64.
Preparing to unpack .../3-libatlas3-base_3.10.3-12ubuntu1_amd64.deb ...
Unpacking libatlas3-base:amd64 (3.10.3-12ubuntu1) ...
Selecting previously unselected package libatlas-base-dev:amd64.
Preparing to unpack .../4-libatlas-base-dev_3.10.3-12ubuntu1_amd64.deb ...
Unpacking libatlas-base-dev:amd64 (3.10.3-12ubuntu1) ...
Selecting previously unselected package libblas-dev:amd64.
Preparing to unpack .../5-libblas-dev_3.10.0-2ubuntu1_amd64.deb ...
Unpacking libblas-dev:amd64 (3.10.0-2ubuntu1) ...
Selecting previously unselected package liblapack-dev:amd64.
Preparing to unpack .../6-liblapack-dev_3.10.0-2ubuntu1_amd64.deb ...
Unpacking liblapack-dev:amd64 (3.10.0-2ubuntu1) ...
Selecting previously unselected package python-pkg-resources.
Preparing to unpack .../7-python-pkg-resources_44.1.1-1.2_all.deb ...
Unpacking python-pkg-resources (44.1.1-1.2) ...
Selecting previously unselected package python-setuptools.
Preparing to unpack .../8-python-setuptools_44.1.1-1.2_all.deb ...
Unpacking python-setuptools (44.1.1-1.2) ...
Selecting previously unselected package python-pip.
Preparing to unpack .../9-python-pip_20.3.4+dfsg-4_all.deb ...
Unpacking python-pip (20.3.4+dfsg-4) ...
Setting up libatlas3-base:amd64 (3.10.3-12ubuntu1) ...
update-alternatives: using /usr/lib/x86_64-linux-gnu/atlas/libblas.so.3 to provide /usr/lib/x86_64-linux-gnu/libblas.so.3 (libblas.so.3-x86_64-linux-gnu) in auto mode
update-alternatives: using /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3 to provide /usr/lib/x86_64-linux-gnu/liblapack.so.3 (liblapack.so.3-x86_64-linux-gnu) in auto mode
Setting up libgfortran-11-dev:amd64 (11.2.0-19ubuntu1) ...
Setting up python-pkg-resources (44.1.1-1.2) ...
Setting up libatlas-base-dev:amd64 (3.10.3-12ubuntu1) ...
update-alternatives: using /usr/lib/x86_64-linux-gnu/atlas/libblas.so to provide /usr/lib/x86_64-linux-gnu/libblas.so (libblas.so-x86_64-linux-gnu) in auto mode
update-alternatives: using /usr/lib/x86_64-linux-gnu/atlas/liblapack.so to provide /usr/lib/x86_64-linux-gnu/liblapack.so (liblapack.so-x86_64-linux-gnu) in auto mode
Setting up liblapack-dev:amd64 (3.10.0-2ubuntu1) ...
Setting up python-setuptools (44.1.1-1.2) ...
Setting up gfortran-11 (11.2.0-19ubuntu1) ...
Setting up libblas-dev:amd64 (3.10.0-2ubuntu1) ...
Setting up gfortran (4:11.2.0-1ubuntu1) ...
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode
update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode
Setting up python-pip (20.3.4+dfsg-4) ...
Processing triggers for man-db (2.10.2-1) ...
Processing triggers for libc-bin (2.35-0ubuntu3.1) ...
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ export LC_ALL=C
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo pip install -U setuptools
sudo: pip: command not found
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo pip3 install -U setuptools
sudo: pip3: command not found
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo apt install python3-pip
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following packages were automatically installed and are no longer required:
  python-pkg-resources python-setuptools systemd-hwe-hwdb
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  python-pip
The following NEW packages will be installed:
  python3-pip
0 upgraded, 1 newly installed, 1 to remove and 14 not upgraded.
Need to get 1306 kB of archives.
After this operation, 2151 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://us.archive.ubuntu.com/ubuntu jammy/universe amd64 python3-pip all 22.0.2+dfsg-1 [1306 kB]
Fetched 1306 kB in 0s (2949 kB/s)    
(Reading database ... 212816 files and directories currently installed.)
Removing python-pip (20.3.4+dfsg-4) ...
Selecting previously unselected package python3-pip.
(Reading database ... 212315 files and directories currently installed.)
Preparing to unpack .../python3-pip_22.0.2+dfsg-1_all.deb ...
Unpacking python3-pip (22.0.2+dfsg-1) ...
Setting up python3-pip (22.0.2+dfsg-1) ...
Processing triggers for man-db (2.10.2-1) ...
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo pip install -U setuptools
Requirement already satisfied: setuptools in /usr/lib/python3/dist-packages (59.6.0)
Collecting setuptools
  Downloading setuptools-65.4.0-py3-none-any.whl (1.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.2/1.2 MB 8.5 MB/s eta 0:00:00
Installing collected packages: setuptools
  Attempting uninstall: setuptools
    Found existing installation: setuptools 59.6.0
    Not uninstalling setuptools at /usr/lib/python3/dist-packages, outside environment /usr
    Can't uninstall 'setuptools'. No files were found to uninstall.
Successfully installed setuptools-65.4.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ sudo pip install -U numpy scipy scikit-learn sklearn cython falcon gunicorn gevent
Collecting numpy
  Downloading numpy-1.23.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (17.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 17.1/17.1 MB 20.4 MB/s eta 0:00:00
Collecting scipy
  Downloading scipy-1.9.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (43.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 43.9/43.9 MB 19.5 MB/s eta 0:00:00
Collecting scikit-learn
  Downloading scikit_learn-1.1.2-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (30.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 30.5/30.5 MB 20.9 MB/s eta 0:00:00
Collecting sklearn
  Downloading sklearn-0.0.tar.gz (1.1 kB)
  Preparing metadata (setup.py) ... done
Collecting cython
  Downloading Cython-0.29.32-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.manylinux_2_24_x86_64.whl (1.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.9/1.9 MB 25.2 MB/s eta 0:00:00
Collecting falcon
  Downloading falcon-3.1.0-cp310-cp310-manylinux_2_5_x86_64.manylinux1_x86_64.manylinux_2_17_x86_64.manylinux2014_x86_64.whl (8.5 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 8.5/8.5 MB 28.2 MB/s eta 0:00:00
Collecting gunicorn
  Downloading gunicorn-20.1.0-py3-none-any.whl (79 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 79.5/79.5 KB 23.0 MB/s eta 0:00:00
Collecting gevent
  Downloading gevent-21.12.0-cp310-cp310-manylinux_2_12_x86_64.manylinux2010_x86_64.whl (6.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 26.2 MB/s eta 0:00:00
Collecting joblib>=1.0.0
  Downloading joblib-1.2.0-py3-none-any.whl (297 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 298.0/298.0 KB 33.4 MB/s eta 0:00:00
Collecting threadpoolctl>=2.0.0
  Downloading threadpoolctl-3.1.0-py3-none-any.whl (14 kB)
Requirement already satisfied: setuptools>=3.0 in /usr/local/lib/python3.10/dist-packages (from gunicorn) (65.4.0)
Collecting zope.interface
  Downloading zope.interface-5.4.0.tar.gz (249 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 249.3/249.3 KB 12.9 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... done
Collecting greenlet<2.0,>=1.1.0
  Downloading greenlet-1.1.3-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (155 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 155.9/155.9 KB 9.9 MB/s eta 0:00:00
Collecting zope.event
  Downloading zope.event-4.5.0-py2.py3-none-any.whl (6.8 kB)
Building wheels for collected packages: sklearn, zope.interface
  Building wheel for sklearn (setup.py) ... done
  Created wheel for sklearn: filename=sklearn-0.0-py2.py3-none-any.whl size=1304 sha256=f9f7ef254bed683fe0d75c6eac7dc6b8e9d01b7a52740fd545e242b1c01d9d4f
  Stored in directory: /root/.cache/pip/wheels/9b/13/01/6f3a7fd641f90e1f6c8c7cded057f3394f451f340371c68f3d
  Building wheel for zope.interface (setup.py) ... done
  Created wheel for zope.interface: filename=zope.interface-5.4.0-cp310-cp310-linux_x86_64.whl size=244064 sha256=7efac5353688a60d7767a357761c0c60387c97def1e6abd831d22628ea062059
  Stored in directory: /root/.cache/pip/wheels/21/a9/8b/0bfc5594d8e109d5b25d6b69e0cff14d09d93e3522dcb16d2b
Successfully built sklearn zope.interface
Installing collected packages: zope.interface, zope.event, threadpoolctl, numpy, joblib, gunicorn, greenlet, falcon, cython, scipy, gevent, scikit-learn, sklearn
Successfully installed cython-0.29.32 falcon-3.1.0 gevent-21.12.0 greenlet-1.1.3 gunicorn-20.1.0 joblib-1.2.0 numpy-1.23.3 scikit-learn-1.1.2 scipy-1.9.1 sklearn-0.0 threadpoolctl-3.1.0 zope.event-4.5.0 zope.interface-5.4.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ ls
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ mkdir opt
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2$ cd opt/
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2/opt$ git clone https://github.com/mikelynn2/sentimentAPI.git
Cloning into 'sentimentAPI'...
remote: Enumerating objects: 2087, done.
remote: Total 2087 (delta 0), reused 0 (delta 0), pack-reused 2087
Receiving objects: 100% (2087/2087), 6.56 MiB | 13.76 MiB/s, done.
Resolving deltas: 100% (41/41), done.
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2/opt$ ls
sentimentAPI
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2/opt$ cd ./sentimentAPI/
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2/opt/sentimentAPI$ gunicorn -c gunicornSettings.py sentimentAPI:app
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2/opt/sentimentAPI$ curl -H "Content-Type: application/json" -X POST -d '{"text":"thats great!"}' http://127.0.0.1:8000/api/sentiment/v1
curl: (7) Failed to connect to 127.0.0.1 port 8000 after 0 ms: Connection refused
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2/opt/sentimentAPI$ curl -vX POST http://127.0.0.1:8000/api/sentiment/v1 -d @example.json --header "Content-Type: application/json"
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying 127.0.0.1:8000...
* connect to 127.0.0.1 port 8000 failed: Connection refused
* Failed to connect to 127.0.0.1 port 8000 after 0 ms: Connection refused
* Closing connection 0
curl: (7) Failed to connect to 127.0.0.1 port 8000 after 0 ms: Connection refused
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2/opt/sentimentAPI$ ab -p example.json -T application/json -c 10 -n 2000 http://127.0.0.1:8000/api/sentiment/v1
Command 'ab' not found, but can be installed with:
sudo apt install apache2-utils
john@john-Latitude-3310-2-in-1:~/PycharmProjects/sentimentAPI2/opt/sentimentAPI$ 

JohnReedLOL avatar Sep 29 '22 07:09 JohnReedLOL

Hi john - i wrote this in python2, it needs a conversion to 3 but i dont have time to do that. ubuntu 22 is default python3

mikelynn2 avatar Sep 29 '22 12:09 mikelynn2