Can't install BigARTM python library on linux - python

I'm trying to install BigARTM on my mint following this instruction, all steps seems to be passed successful, for example last one:
*#*​-PC ~ $ cd ~/bigartm/python
​*#*​-PC ~/bigartm/python $ sudo python setup.py install
returns: ...Finished processing dependencies for bigartm==0.8.0
So import artm gives me import error (this is how it might be imported)
What might be wrong?

Related

how to import coco_utils and coco_eval?

To get a PyTorch script to work, I need to be able to do:
import coco_utils
import coco_eval
I'm using Ubuntu 18.04 with Python 3.
Based on this post:
How to install COCO PythonAPI in python3
I've done the following so far:
cd ~
git clone https://github.com/cocodataset/cocoapi.git
cd cocoapi/PythonAPI
# open Makefile in gedit, change the two instances of "python" to "python3"
python3 setup.py build_ext --inplace
sudo python3 setup.py install
now this works:
import pycocotools
but these still don't:
import coco_utils
import coco_eval
How can I import coco_utils and coco_eval ??
coco_utils.py and coco_eval.py must be the name of the files that should be in the repository you're trying to use.
Possibly you're looking for the object detection reference training scripts provided in the detection (vision/references/detection/) module of torchvision.

How to fix 'No module named cv2' in AWS EC2 Linux, imports from Command Line

I am deploying a web application onto an AWS EC2 instance, and I'm getting an error. The logs indicate that I do not have cv2 installed.
ModuleNotFoundError: No module named 'cv2'
However, if I ssh into my instance, and run python from the shell I can import no problem.
https://drive.google.com/drive/folders/1-w3BN9pMAhkiDM40fODCPdjvU1Nx71UT?usp=sharing
I have already installed opencv onto the Linux server and checked that it is available for import.
From my application.py file
import cv2
File "/opt/python/current/app/localize.py", line 9, in
but from the command line:
>>> import cv2
>>> cv2.__version__
'4.1.0'
I expected the import to work since it works from the command line.
Check if your python package is available for the root/admin user but not accessible for the user trying to run the code?
If you can import that module in your EC2, then it is installed, but more importantly for which user it is installed, and for which version.
First try :
chmod 755 on all directories in python path for your default python and see if it works.(This will provide permissions for all import libraries in Python)
If your script is running Python3.7 and Default is Python2.7 then you might have to do --
sudo pip3 install opencv-python
the way to check the version defaults is:
which python ---Will provide default python path and version
which pip ---- Will Provide default PIP details
As #rayryeng suggested, I'm running Python 3.x from Elastic Beanstalk, and Python 2.x from command line. I fixed it by installing the correct version of cv2 for Python 3 and including the following before my import:
import sys
sys.path.append('/usr/local/lib64/python3.6/site-packages')
Try this:
cd
wget https://github.com/opencv/opencv/archive/3.2.0.zip
virtualenv project
source project/bin/activate
pip install numpy
mkdir local
unzip opencv-3.2.0.zip
cd opencv-3.2.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D BUILD_SHARED_LIBS=NO -D WITH_FFMPEG=ON -D BUILD_opencv_python2=ON -D CMAKE_INSTALL_PREFIX=~/local ~/opencv-3.2.0
make
make install
cp ~/local/lib/python2.7/site-packages/cv2.so ~/project/lib64/python2.7/site-packages/
Read more from here: Source

Installing Python-Tesseract on a Linux system

I am having trouble installing python-tesseract on my linux system. I've been using this tutorial:
http://delimitry.blogspot.be/2014/10/installing-tesseract-for-python-on.html
The error I get is:
File does not exist:['/usr/include/tesseract/capi.h', '/usr/local/include/tesseract/capi.h', '/opt/include/tesseract/capi.h', '/opt/local/include/tesseract/capi.h']
root#opencv:/home/philipp/python-tesseract#
When running python setup.py clean in /python-tesseract after following the rest of the instructions in order.
Running linux 3.2.0-4-amd64 on this system.
Whereis tesseract-ocr returns:
/usr/share/tesseract-ocr
Whereis leptonica returns:
/usr/include/leptonica
Whereis tesseract returns:
tesseract: /usr/bin/tesseract /usr/bin/X11/tesseract /usr/include/tesseract/ /usr/share/man/man1/tesseract.1.gz
I've also tried running a few other tutorials/guides to install python-tesseract that have returned other errors such as, missing libleptonica then missing libc6 but I havn't investigated these as much. Just tried to see if any other guides worked immidiately.
Also, when I run tesseract in the terminal it works, but import tesseract does not.
What am I doing wrong? How can I fix this and install python-tesseract?
I think this way could work for you:
1- download python-tesseract_0.9-0.5ubuntu3_vivid_amd64.deb from here
2- install gdebi-core
sudo apt-get install gdebi-core
3- install python-tesseract_0.9-0.5ubuntu3_vivid_amd64.deb with gdebi
sudo gdebi python-tesseract_0.9-0.5ubuntu2_i386.deb

Updating the SQLite3 build on my python install

noob programmer here, I'm trying to get the SQLite3 on my Python installation up-to-date (I currently have version 3.6.11, whereas I need at least version 3.6.19, as that is the first version that supports foreign keys). Here's my problem, though: I have no idea how to do this. I know next to nothing about the command line, and I don't really know what files to replace (if at all) in my python install. And before anyone asks, I'm already using the latest Pysql version – it's what's not up to date. Can anyone give me some pointers, or maybe a guide on how to update this?
I'm on Mac OSX 10.5.8, working with python 2.6.
I suggest using the 'pip' command on the command line.
pip search sqlite
pip install pysqlite
I just came fresh from installing this both in Mavericks and Mountain Lion.
This SO article mentions using the build_static method, which they say retrieves that latest version of the sqlite amalgamation. For some reason it didn't work (ie it didn't seem to download it or use it)
What I ended up doing was
Downloaded pysqlite as a tarball
Downloaded latest sqlite source amalgamation
Unzipped pysqlite into its folder
Unzipped sqlite and copied that to the pysqlite folder
Opened setup.cfg and commented out all of the directives
In Terminal, went to the pysqlite folder, and then:
$ python setup.py build_static install
This compiled pysqlite using the libraries from the latest sqlite sources. And then in Python, I used it as:
import pysqlite2.dbapi2 as sqlite3
I recently installed python from source and used the following commands to install both SQLite from source and Python 2.7.13 from source.
for SQLite3 you can use the following commands
$SQLITE_INSTALL_LOCATION
$ curl -O http://www.sqlite.org/sqlite-autoconf-3070603.tar.gz
$ tar xvfz sqlite-autoconf-3070603.tar.gz
$ cd sqlite-autoconf-3070603
$ ./configure --prefix=$SQLITE_INSTALL_LOCATION --disable-static CFLAGS="-g"
$ make && make install
Then when I compiled my python I edited the setup.py in the root of the Python source
$ curl -O https://www.python.org/ftp/python/2.7.13/Python-2.7.13.tgz
$ tar xvfz Python-2.7.13.tgz
Python-2.7.13/setup.py -- add the path to your SQLite install here:
```
...
# We hunt for #define SQLITE_VERSION "n.n.n"
# We need to find >= sqlite version 3.0.8
sqlite_incdir = sqlite_libdir = None
sqlite_inc_paths = [ '/usr/include',
'/usr/include/sqlite',
'/usr/include/sqlite3',
'/usr/local/include',
'/usr/local/include/sqlite',
'/usr/local/include/sqlite3',
$SQLITE_INSTALL_LOCATION/include,
]
...
Once you've changed the setup.py in your python source finish up compiling and installing python assuming the install location is $PYTHON_INSTALL_LOCATION
$ cd Python-2.7.13
$ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib ./configure --prefix=$PYTHON_INSTALL_LOCATION --enable-shared --enable-unicode=ucs4
$ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib make
$ LD_RUN_PATH=$SQLITE_INSTALL_LOCATION/lib make install
Once you do that you should have a Python version with SQLite3 support installed at $PYTHON_INSTALL_LOCATION/bin/python
Hope this helps!
Disclaimer: I'm not a Mac User, but by common knowledge i give you
this info.
You could follow the next instructions:
Use Homebrew
As this page mention: If you need to upgrade sqlite, you could use Homebrew.
Homebrew implies an aditional "software manager". So you should know how to use it before.
Install it from the source
As this page metion:
Download the sqlite-autoconf package
Compile it and install it:
:
$ tar xvfz sqlite-autoconf-3071502.tar.gz
$ cd sqlite-autoconf-3071502
$ ./configure --prefix=/usr/local
$ make
$ make install
Either Homebrew or Source, verfy it
>>> import sqlite3
>>> sqlite3.version_info
(2, 4, 1)
>>> sqlite3.sqlite_version_info
(3, 6, 11)
>>> from pysqlite2 import dbapi2 as sqlite3
>>> sqlite3.version_info
(2, 5, 5)
>>> sqlite3.sqlite_version_info
(3, 6, 18)
Maybe you need to uninstall previous version of pysqlite. In any way, you should read this answer to understand better the sqlite/python relationship.
https://pip.pypa.io/en/latest/installing.html
python get-pip.py
python [complete path]
python c:\folder\get-pip.py

Python setuptools import error (Using NetBeans)

I tried to find a question that would answer to this question but wasn't succesful, so I made a new question.
I'm trying to compile my old Python Tic Tac Toe game in NetBeans, but I get the error message
ImportError: No module named setuptools
In my actual code I haven't imported a module named setuptools. As much as I understand the compiler generates a setup.py file and tries to use that setuptools module in there. How can I fix that problem?
I'm pretty sure that the problem isn't in the code as that same code worked perfectly the time when I actually made it and I haven't changed it after that.
You need to install either setuptools or Distribute in your Python instance. Follow the directions at either web page.
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
python setup.py install
Same answer as Satya, but easier to copy&paste:
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
sudo python setup.py install
Same answer as above, but since I dont have comment rights here is the working version which ignores the certificate mismatch for ssl auto-redirect :
wget --no-check-certificate http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz
tar zxvf setuptools-0.6c11.tar.gz
cd setuptools-0.6c11
python setup.py build
sudo python setup.py install

Categories