No module named poppler with python-poppler installed - python

please, don't mark it as duplicate, because solutions to similar questions don't work for me
My system is ubuntu 16.04, I'm using python 2.7.12
What I am trying to do, is to use pdftohtml to convert pdf files to html. It seems that I could do it with poppler.
I've installed python-poppler with sudo apt-get install and it seems installed:
dpkg -s python-poppler
Package: python-poppler
Status: install ok installed
Priority: optional
Section: python
Installed-Size: 144
Maintainer: Ubuntu Developers <ubuntu-devel-discuss#lists.ubuntu.com>
Architecture: amd64
Version: 0.12.1-8.1
Provides: python2.7-poppler
Depends: libc6 (>= 2.4), libglib2.0-0 (>= 2.12.0), libgtk2.0-0 (>= 2.8.0), libpoppler-glib8 (>= 0.18.0), python (>= 2.7), python (<< 2.8), python-gtk2 (>= 2.10.0), python-gobject (>= 2.10.1), python-cairo (>= 1.8.4)
Description: Poppler Python bindings
This package includes Python bindings for LibPoppler.
It is needed to run programs written in Python and using Poppler set.
LibPoppler is a PDF rendering library based on xpdf PDF viewer, and used by
kpdf and evince PDF viewers.
Original-Maintainer: Andrea Gasparini <gaspa#yattaweb.it>
Homepage: http://launchpad.net/poppler-python
however, on import poppler it throws an import error.
What am I missing here?

Ok, the problem was my virtual env wasn't created with any parameters - so --no-site-packages was used as a default value.
when I recreated it using mkvirtualenv --system-site-packages, everything is ok.

Related

How can I specify the non-default package python3.8 as a dependency instead of python3 when building a debian package for Ubuntu?

I have a custom Python package/script for which I am trying to build a Debian
package. It builds and installs fine on a Debian 11 system. Now I also want to
package it for a machine with Ubuntu 18.04 on it.
The program is using annotations which are supported from Python 3.8 onwards (with from __future__
import ...), hence I need at least 3.8. On Ubuntu 18.04 the standard python3 is
3.6.7, but the package python3.8 provides 3.8. However, despite my best efforts, I just
can't figure out how to specify the non-default version as a sole dependency, i.e. tell
debuilder etc. to only depend on python3.8 and NOT on python3 (default).
Is this
somehow possible and if so how? All packages needed to run this program are in
the standard repositories, so I figure it should be possible to define the
dependencies correctly - somehow. I am relatively new to packaging and any
pointers are much appreciated (although I have read the easy-to-find documentation and such...)
Things that I have tried up to now
(only the relevant parts of /debian/control are shown):
Depending on python3 and python3.8,
not explicitly specifying X-Python version:
/debian/control
...
Build-Depends:
debhelper (>= 11),
dh-python,
python3,
python3.8,
python3-setuptools
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...
-> builds, but won't configure (during package install) as it is using python 3.6.x
from __future__ import annotations
^
SyntaxError: future feature annotations is not defined
Depending on python3 and python3.8,
and specifying X-Python version
...
Build-Depends:
debhelper (>= 11),
dh-python,
python3,
python3.8,
python3-setuptools
X-Python3-Version: >= 3.8
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...
-> builds, but also won't configure (during package install)
xxx depends on python3:any (>= 3.8~); however:
Version of python3 on system is 3.6.7-1~18.04.
Only depending on python3.8,
and specifying X-Python version
...
Build-Depends:
debhelper (>= 11),
dh-python,
python3.8,
python3-setuptools
X-Python3-Version: >= 3.8
...
Depends: ${misc:Depends}, ${python3:Depends}, python3.8
...
-> errors during build (missing dependency)
E: xxx source: missing-build-dependency-for-dh-addon python3 => python3:any | python3-all:any | python3-dev:any | python3-all-dev:any
E: xxx source: missing-python-build-dependency
E: xxx source: missing-python-build-dependency
-> and errors during package install
xxx depends on python3:any (>= 3.8~); however:
Version of python3 on system is 3.6.7-1~18.04.

GDAL libraries, who does what

I'm struggling installing GDAL on ubuntu 16.04 to work with GeoDjango (Django 2.1, python3), so I need to understand what I'm actually installing.
What is the rôle of each library/package/module ?
apt
gdal-bin (A 'C' library containing the actual functions ?)
python-gdal (The same in python, or just some kind of bridge ?)
python3-gdal (see above, but for python3. Does it need python-gdal ?)
pip
gdal
pygdal
What is the link between pip modules and apt packages here ?
Every piece of info is available, if one is willing to search for it.
DEBs (installed system-wide):
gdal-bin ([Ubtu]: Package: gdal-bin) - a collection of gdal related binaries (tools and utilities)
python3-gdal ([Ubtu]: Package: python3-gdal) - Python 3 bindings, extensions (.sos) and some wrapper scripts, which enable gdal usage from Python
python-gdal - the same thing, but for Python 2 (totally unrelated to previous item)
WHLs (installed as Python modules to the interpreter used to launch pip):
GDAL ([PyPI]: GDAL) - the sources (.tar.gz) for #2. (and / or #3.). During pip install phase, they are built and installed for current Python
pygdal ([PyPI]: pygdal) - same thing (but for VEnv?) as previous item. It seems to be a lighter version (it doesn't contain the scripts)
But, all of the above depend on libgdal ([Ubtu]: Package: libgdal1i), which is the gdal library.

Python3 can't see opencv-python, numpy, PyQt5

I installed opencv-python numpy PyQt5 using brew. Unfortunately it installed only for python in version 2 but I wanted it to ver 3. So normally when I am using python2 I can import those libs, but in python3 there is just error about not module found.
When I am typing for example brew info numpy, I am getting something like this:
numpy: stable 1.15.2 (bottled), HEAD Package for scientific computing with Python https://www.numpy.org/ /usr/local/Cellar/numpy/1.15.2 (967 files, 25.5MB) Poured from bottle on 2018-10-15 at 12:13:26 From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/numpy.rb
==> Dependencies Build: gcc ✔ Recommended: python ✔, python#2 ✔
==> Options
--without-python Build without python support
--without-python#2 Build without python2 support
--HEAD Install HEAD version
==> Analytics install: 33,262 (30d), 96,001 (90d), 314,869 (365d) install_on_request: 5,934 (30d), 19,037 (90d), 56,029 (365d) build_error: 0 (30d)
So like you can see there is just python2 in "Recommended". Is there any possibility to repair this mistake and link somehow those libs to python3?
I am using macOS High Sierra.
Why don't you use pip3 for installing packages for python3? Brew is for installing applications, not libraries.
Problem solved. Recently, Python.org sites stopped supporting TLS version 1.0 and 1.1. This helped:
curl https://bootstrap.pypa.io/get-pip.py | python3

python 3.7 import smbus ModuleNotFoundError no module named 'smbus'

I successfully built python 3.7 on my raspberry pi zero. now when I run my program using:
python3 DungeonCube.py
I get the following error:
import smbus
ModuleFoundError: No module named 'smbus'
I have searched for solutions and it seems no one has gotten this far with python 3.7 on a raspberry pi. other guides say to reinstall smbus or install smbus2 and that does not work.
dpkg-query -L python3-smbus shows:
/.
/usr
/usr/lib
/usr/lib/python3
/usr/lib/python3/dist-packages
/usr/lib/python3/dist-packages/smbus.cpython-35m-arm-
linux-gnueabihf.so
/usr/share
/usr/share/doc
/usr/share/doc/python3-smbus
/usr/share/doc/python3-smbus/changelog.Debian.gz
/usr/share/doc/python3-smbus/changelog.gz
/usr/share/doc/python3-smbus/copyright
apt-cache show python3-smbus shows:
Package: python3-smbus
Version: 3.1.2-3
Architecture: armhf
Maintainer: Aurelien Jarno <aurel32#debian.org>
Installed-Size: 31
Depends: libc6 (>=2.4), python3 (<< 3.6), python3 (>=
3.5~), python3:any (>= 3.0~)
Recommends: i2c-tools
Provides: python3.5-smbus
.
.
.
Any ideas how to get this working?
Garry O.
The python3-smbus library which is installed on your system seems a little old. It works for Python 3.5 but not for Python 3.7.
You have two solutions:
downgrade your Python to use Python 3.5
choose another library: you can try smbus2 which is more uptodate.
I don't have a RPi to test this on, but when I was in HackerSpace I also built python on R-Pi. I ran into this exact same problem and found a fix that may work for you. You will need to open the config file: "sudo nano /boot/config.txt" and add the line "dtparam=i2c_arm=on" after you save it run "sudo raspi-config". Under advanced options you will find 7l2c select "Yes".

Install ROS Kinetic on MacOS under a separate Anaconda environment

I'm installing ROS Kinetic on MacOS Sierra 10.12.6 under a seperate environment under Python Anaconda distribution.
Here is my python version(my seperate python environment in Anaconda is called "ros-kinetic"):
(ros-kinetic) jizhe#jizhedeMacBook-Pro  ~/ros_catkin_ws  python --version
Python 3.6.4 :: Anaconda, Inc.
I followed the guide: http://wiki.ros.org/kinetic/Installation/OSX/Homebrew/Source.
When I execute the "rosdep install" command, I got the following error:
(ros-kinetic) jizhe#jizhedeMacBook-Pro ~/ros_catkin_ws  rosdep install --from-paths src --ignore-src --rosdistro kinetic -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
actionlib: No definition of [python-wxtools] for OS [osx]
catkin: No definition of [google-mock] for OS [osx]
roslisp: No definition of [google-mock] for OS [osx]
Obviously, there is something wrong with the package "python-wxtools" and "google-mock".
I've already install the wxpython via "brew install wxpython", and here is the wxpython info:
(ros-kinetic) jizhe#jizhedeMacBook-Pro  ~/ros_catkin_ws  brew info wxpython
wxpython: stable 3.0.2.0 (bottled)
Python bindings for wxWidgets
https://www.wxwidgets.org/
/usr/local/Cellar/wxpython/3.0.2.0_1 (1,108 files, 37.9MB) *
Poured from bottle on 2018-02-24 at 03:56:21
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/wxpython.rb
==> Dependencies
Required: wxmac ✔
==> Caveats
Python modules have been installed and Homebrew's site-packages is not
in your Python sys.path, so you will not be able to import the modules
this formula installed. If you plan to develop with these modules,
please run:
mkdir -p /Users/jizhe/Library/Python/2.7/lib/python/site-packages
echo 'import site; site.addsitedir("/usr/local/lib/python2.7/site-packages")' >> /Users/jizhe/Library/Python/2.7/lib/python/site-packages/homebrew.pth
And I've already run the command:
$ mkdir -p ~/Library/Python/2.7/lib/python/site-packages
$ echo "$(brew --prefix)/lib/python2.7/site-packages" >> ~/Library/Python/2.7/lib/python/site-packages/homebrew.pth
So, what's wrong with the package "google-mock" and "python-wxtools", how can I solve this problem?
Try installing with --skip-keys python-wxtools --skip-keys google-mock. It worked for me.
There is a ticket for this issue. Basically the workaround is to install googletest manually. Not sure what's wrong with python-wxtools.
edit: If you're using ros-install-osx, you can add the following lines to your rosdeps.yaml file:
google-mock:
osx:
homebrew:
packages: []
I found this question from a Google search, just for your information in 2021 installing ROS in conda also on macOS should be much straightforward, see the following links:
https://medium.com/robostack/cross-platform-conda-packages-for-ros-fa1974fd1de3
https://github.com/RoboStack/ros-noetic

Categories