Step by step: Installing Python 3.3, Lighttpd & Pymongo on Ubuntu 12.04 - python-3.x

I'm currently migrating to new computer and I need to reinstall the software I am using which are:
Python 3.3,
Lighttpd (newest version),
Pymongo (newest version),
Ubuntu 12.04 Desktop (The System I'm using)
I started to install Python 3.3 by downloading it from the its official website (in tar.bz2 file) and by following this tutorial. Afterwards I installed Lighttpd and changed the lighttpd.conf for Python by following this tutorial, too.
I tried several paths for my cgi.assign, none of them worked. Especially /opt/python3.3/bin/python3.3 should be working, but it shows 500 - internal Server error all the time with a "hello world" test script.
Now regardless to this problem I have no clue on installing Pymongo. If I try to intall pip OR easy_install python3.3 I have to manually download it and execute the setup.py with my python3.3 executable, right? Because this always fails with an error:
`Error missing zlib on a bundle called distribute-0.7.3 (is this even the right tool I need, because it seems to be a legacy wrapper !?) or unknown url type: https for pymongo2.6.2 itself.`
I'm getting crazy with this setup. Why is this so difficult to handle? Other programs are just a few clicks to install even on a system like Ubuntu, but these particular development tools seem to be really difficult to install.If anybody has an idea on how to install all three together or has information on a better solution please help me out.
The system is used to program Python scripts in Eclipse and trying them out directly on the system (lighttpd). The database used is MongoDB. Python and MongoDB are communicating over the Pymongo driver. I am planning to use the system on a Server distribution on release and it has to be nicely scalable on a high amount of excecutions.
Thanks for your time,

It's easiest to use the Ubuntu repositories:
sudo apt-get update
sudo apt-get install python3 python3-pip lightppd python-pymongo
Or if that only installs the python2.x pymongo, use pip, which you've just installed:
sudo pip-3.3 install pymongo
Or better yet, use a virtualenv with the help of virtualenvwrapper (docs)
sudo pip install virtualenvwrapper
... # follow instructions for installing virtualenvwrapper
mkvirtualenv --python=/usr/bin/python3 -i pymongo mongoppd
workon mongoppd
... which will segregate the environment I've called 'mongoppd' from the rest of your system so you can't cause any trouble. Then you don't need sudo to pip-3.3 install things, just workon mongoppd then pip-3.3 install [...]. Or after the -i flag when you create the virtualenv to get it installed straight away.
In general, on Ubuntu, you should hardly ever have to install something manually. Your first attempt should be using sudo apt-get install (use tab-complete to see what's available or just google "ubuntu 12.04 packages [...]" and you'll find the list of packages). Then for python use pip install or pip-3.3 install as appropriate. You'll only need to run python setup.py install if you need to install a development version of a package or something obscure that's not on pip. I don't think there's a good reason to ever use easy_install these days.

Related

python3: can't install psycopg2 [duplicate]

I cannot figure this out for the life of me.
When I pip install django-tenant-schemas it tries to install the dependency psycopg2 which requires the Python headers and gcc. I have all this installed and still keep getting this error!
./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory
So to install libpq-fe-h I need to sudo apt-get install libpq-dev..
..which returns..
libpq-dev is already the newest version (10.10-0ubuntu0.18.04.1).
Then when I sudo find / libpq-fe.h it doesn't seem to be in my OS.
I am lost at this point. If anyone can help I would highly appreciate it.
For some reason, the file is missing on the system.
As you're using apt-get, the system is dpkg based, presumably Debian or it's derivative. You can try the Ubuntu's package search to get which package contains a file with name ending in libpq-fe.h.
I found the package is libpq-dev and file's absolute path is /usr/include/postgresql/libpq-fe.h.
FWIW, on a dpkg based system, you can check which package gives a file if you know the file's absolute path:
% dpkg -S /usr/include/postgresql/libpq-fe.h
libpq-dev: /usr/include/postgresql/libpq-fe.h
Also, unlike find, locate keeps a cache of found files (mlocate.db) that is created everyday via cron; so if the file happens to be removed after the last run, you can run locate libfq-fe.h to get the absolute path to the file without needing to check the Ubuntu package search online.
So the package is libpq-dev. Now, reinstalling it will get everything to the default state i.e. all relevant files will be copied to the right places. As it is only a library package, no user/system level configurations will be overridden (and dpkg will prompt you for action for any package that does that).
To reinstall the package:
sudo apt-get install --reinstall libpq-dev
For me, I realized it was trying to use the deprecated setup.py so I installed wheel (pip install wheel) and that sorted it all out.
Well after installing these libraries
sudo dnf install python-virtualenv openssl-devel gcc libffi-devel libxslt-devel issue was not gone.
I used mlocate to find where libpq-fe.h file is located. On my system (Fedora 32) it was located at /usr/pgsql-10/include/libpq-fe.h
yum install mlocate
sudo updateb
locate libpq-fe.h
After all added this line to ~/.bash_profile
nano ~/.bash_profile
export PATH=/usr/pgsql-10/bin/:$PATH
Works fine, I can easily install psycopg2 without any trouble.
You need to create a LD_LIBRARY_PATH that indicates the path of your library /user/pgsql-11/lib
Source: The 3rd point of build prerequisites at https://www.psycopg.org/docs/install.html#build-prerequisites

RequestsDependencyWarning: when running gsutil command

Im gettng the below error when i try to run this command on ubuntu 18
gsutil ls
/snap/google-cloud-sdk/161/lib/third_party/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
Tried to run gcloud components update but i got this error
(gcloud.components.update) You cannot perform this action because this Cloud SDK installation is managed by an external package manager.
Please consider using a separate installation of the Cloud SDK created through the default mechanism described at: https://cloud.google.com/sdk/
Am i missing anything ?
This is because your python interpreter and his dependencies are outdated, also, your Gcloud SDK package was installed via snap package, when Gcloud SDK is installed via apt repository or snap package the command gcloud components update will not work, instead you need to run the proper command to update your packages, in your case you need to run this command to update your snap packages
sudo snap refresh
To update the python's packages cryptography and request you need to install the OS package python-pip and after that update your outdated packages
sudo apt-get install python-pip
python -m pip install --upgrade cryptography
python -m pip install --upgrade requests
Since this is a warning message, you can continue working with gcloud/gsutil, but keeping your Python interpreter updated will allow you to use new functions in software written in Python, for example, the Gcloud SDK.

Installing idle3 on kali 2020.2

I successfully installed python 3.8.3 on kali linux. However, i am unable to install idle3. I tried several methods suggested but none work. One of the methods I used was "sudo apt-get install idle3 " the error message it gives me is "E: Unable to locate package idle3". How can I resolve this?
IDLE uses tkinter and is typically installed only when tkinter is. On linux, the separate package is usually python-tk and at least one site claims that this is so on kali. (I searched kali linux python tkinter.) So try the following and if it does not work, look more on the kali-linux site.
sudo apt-get install python-tk

How does one install Tesseract-OCR 3.03 in Ubuntu/Linux distributions?

A friend and I are interested in training the tesseract-OCR engine for a CV project. We tried using some wrappers such as PyTesser and pyocr, but the results are currently not as accurate as we need them to be. As such, we want to try training the tesseract to perform better for our purposes (i.e. identifying text on food labels), but are having some trouble installing the training tools.
What we've tried:
Looking on the google code website, the 'Compiling' page on the tesseract's google code wiki says the training tools are only available on version 3.03. However, the google code 'Downloads' page for tesseract-ocr only has the materials for 3.02. The bottom of the 'Compiling' page also has some comments about installing version 3.03 on Windows and OSX, but no comments yet for Linux users.
There also appears to be some sort of 3.03 source package for Ubuntu but we're not sure how to access it on our computers and the 'Compiling' page says we need to run these commands:
make training
sudo make training-install
We've also found a google group thread about tesseract 3.03 but again it seems like these posts do not include advice for Linux users (unless we missed something during the initial read).
Is this actually a really simple command-line install problem? Or, is there a way train tesseract with 3.02 (which we currently have installed)? Have we been looking at the wrong places for information?
Any advice or links to instructions for installing tesseract-ocr 3.03 for Linux distributions would be greatly appreciated! Thanks.
Tesseract can directly be installed in Ubuntu 14.04 using
sudo apt-get install tesseract-ocr
I don't have any idea if you can do it in older version of Ubuntu because the repo might be updated in later version of Ubuntu.
I had an aws ubuntu 14.04 instance.
when I tried installing Tesseract with
sudo apt-get install tesseract-ocr
It retuned package not found
But this worked for me.
sudo apt-get update
sudo apt-get install tesseract-ocr
Ubuntu is a debian based Linux distribution. The tesseract package you find will most likely be a debian package which will contain tesseract and the required default language files to allow you to run/train tesseract. You do NOT want the source package -- unless you just want to compile it yourself -- no need. You will not have to build tesseract, you just need to install the package. First, it appears you are new to Ubuntu, so please ready InstallingSoftware. It can be as easy as opening up an x-term and issuing the command apt-get install tesseract-pkgname (note: that means whatever the package name is).
There is no shortcut, take the time to understand whether you have a .deb package on your box that need to be installed or whether you are installing from a remote repository. The link above explains how to handle both.
Here is a specific Ubuntu thread dealing with installing tesseract Tesseract 3.0 + Ubuntu 10.04 Installation Guide Hope that helps. Tesseract is very good software.
I don't have any instructions for building Tesseract 3.03 for Linux specifically (I'm on Mac), but here's a link to download the source code for the 3.03 release candidate: https://tesseract-ocr.googlecode.com/archive/3.03-rc1.tar.gz
First run below command
sudo apt-get install tesseract-ocr
It will install tesseract version 3.04
Run below to update the tesseract
sudo apt-get --only-upgrade install tesseract-ocr
It will update tesseract to 4.1.3

System crash after oracle installation with yum

recently i tried to install oracle on my linux with apt (I never used yum before) using fast manual:
http://www.oracle.com/technetwork/articles/servers-storage-admin/ginnydbinstallonlinux-488779.html
And after command:
sudo yum install oracle-rdbms-server-11gR2-preinstall
I got error:
Failed: ca-certificates.noarch 0:2010.63-3.el6_1.5 chkconfig.x86_64 0:1.3.49.3-2.el6 file-libs.x86_64 0:5.04-15.el6 filesystem.x86_64 0:2.4.30-3.el6
initscripts.x86_64 0:9.03.38-1.0.1.el6_4.2
Complete!
And something gone wrong because command like: ps, top are crashing
login#Ass-K55VJ:/etc/yum/repos.d$ ps -e
ps: relocation error: ps: symbol procps_number_version, version _3_2_5 not defined in file libproc-3.2.8.so with link time reference
login#Ass-K55VJ:/etc/yum/repos.d$ top
Segmentation fault (core dumped)
then I tryied to uninstall oracle and dependencies but after command:
sudo yum remove oracle-rdbms-server-11gR2-preinstall
There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:
No module named yum
Please install a package which provides this module, or
verify that the module is installed correctly.
It's possible that the above module doesn't match the
current version of Python, which is:
2.6.6 (r266:84292, Jul 10 2013, 06:42:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]
If you cannot solve this problem yourself, please go to the yum faq at: http://wiki.linux.duke.edu/YumFaq
So it seems like yum install in my system new libraries but didn't link it correctly? I dont know what do in this moment because it seems like armagedon on my ubuntu...
Does this mean you're on ubuntu and tried to install rpm packages using yum? The manual you used is for Oracle Linux 6, why would you try that on ubuntu?
rpm packages are not compatible with debian based systems like ubuntu, which use deb packages. So you've probably screwed your system big time, overwriting important system libraries with incompatible ones.
If apt-get is still working, then you can try to reinstall (apt-get --reinstall install) the equivalent libraries to the ones mentioned in the install manual you linked to - naming isn't always the same for rpm and deb packages. dpkg -l should help you see which the correct installed libraries are. I'd start with the C libraries (libc) etc.
But if apt-get is screwed also, then you'd need to download the packages manually from an ubuntu mirror and install them using dpkg, but I think a reinstall (or restore from backup if you have one) would be the best option.

Resources