pdf2image poppler_path parameter does seem to work - poppler

I am using pdf2image from a conda env after installing poppler on my Win10 system.
I try to use the poppler_path parameter available in the convert_from_path method but it seems that it does not work.
Anyone with experience with pdf2image on Win10 called from a conda env?
Thanks
Jerome

This is what I did, on my Windows 10 and it worked for me:
1) Download the last build from http://blog.alivate.com.au/poppler-windows/
2) Extract its contents to "C:/Program Files (x86)/Poopler/"
3) Install pdf2image package dependency with your preferred method (my version is 1.11.0)
4) Python script:
from pdf2image import convert_from_path
file = "my_pdf.pdf"
pages = convert_from_path(file, 200, poppler_path='C:/Program Files (x86)/Poopler/poppler-0.68.0/bin')
for i, page in enumerate(pages):
<process the page...>
Hope it helps!

Related

cannot import name 'AuthorityMatchInfo' from 'pyproj._crs'

I am trying to use the calc module in metpy. I have installed it both via pip and 'conda forge' option. When i run my script in spyder, i get the following error
ImportError: cannot import name 'AuthorityMatchInfo' from 'pyproj._crs' eg Example file path : (~anaconda3/lib/python3.7/site-packages/pyproj/_crs.cpython-37m-x86_64-linux-gnu.so)
Had the same issue two times and solved it by following advice I found on github.
Basically one needs to uninstall pyproj and reinstall.

Adding pkg-config search path in CentOS

I have this library(lxc) installed which has the .pc file in
/usr/local/lib/pkgconfig I'm working on a modified version of CentOS. Apparantly, I'm having pkg-conf package (instead of pkg-config). When I try to install a package which has dependencies on this library, on running cmake .., I get the error Package 'lxc' required by 'virtual:world', not found /usr/share/cmake/Modules/FindPkgConfig.cmake:467(message): A required package was not found . Now when I do
pkg-config --variable pc_path pkg-config
it shows /usr/lin64/pkgconfig:/usr/share/pkgconfig. So I need to add the /usr/local/lib/pkgconfig to the search path. However, this does not seem straightforward. The general recommended solution is to add this path using export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig. However, this does not work. I also tried adding a file local.conf in the folder /etc/ld.so.conf.d with the content as /usr/local/lib/pkgconfig but this doesn't help either. Searching the man page of pkg_conf here https://man.archlinux.org/man/pkgconf.1.en , I also tried doing export $CMAKE_PREFIX_PATH=/usr/local/lib/pkgconfig, which also doesn't help. I'm a bit out of ideas at this point and would be really grateful if someone could provide an insight.

’unresolved import’ message for streamlit in Eclipse PyDev

I have successfully installed the streamlit package using the following
shell command and can run the resulting local server localhost:8501
Python3.8 -m pip install streamlit
In Eclipse, the module appears under the Package Library in the Python Interpreter.
I can import it as a library item in a PyDev module as as follows:
import streamlit
The only note I get from the compiler is that streamlit is an ‘unused import’. However, when I append the command as follows the compiler then says ‘unresloved import st’
import streamlit as st
Both ‘import streamlit’. and ‘import streamlit as st’ will not code complete.
How can I clear the ’unresolved import’ message ?
The sys.path is as follows:
/Users/davidklemitz/eclipse-workspace/streamlit
/Users/davidklemitz/eclipse-workspace/streamlit
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/lib-dynload
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
/Library/Frameworks/Python.framework/Versions/3.8/lib/python38.zip
Thanks in advance for any help.
I solved the problem. Turns out it was a compound of two issues.
First the name of the PyDev module I chose was the same name as the package module name streamlit.py, installed using the following command
Python3.8 -m pip install streamlit
Second, I had a look at the PYTHONPATH under Eclipse->Preferences-> PyDev->Interpreters-> Python Interpreter where these paths were arranged as follows:
/Library/Frameworks/Python.framework/Versions/3.8/lib
/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages
As streamit.py was in the second and not the first, I reversed the order, restarted Eclipse, created a new PyDev project and associated development model named stream_lit.py and the code completed as expected.

Can you run pychecker from virtualenv?

I want to do code analysis with pychecker but when it imports python code it doesn't use the packages from virtualenv, it uses the system wide one and the import fail.
Is there a way to install pychecker in a virtualenv or at least get it to just import the packages from the virtualenv?
Set your $PYTHONPATH environmental variable to the site-packages directory.
For me, pychecker was not able to find the configobj module. Since I use zsh (bash with lots of bells and whistles), I ran:
> find ~/venv-ops -name configobj.py
/Users/doug/venv-ops/lib/python2.7/site-packages/configobj.py
> export PYTHONPATH=/Users/doug/venv-ops/lib/python2.7/site-packages
and then pycheck worked fine.

LuaSocket in Windows - How to install and use it in an Eclipse Project

When I run my code in terminal,
local function main()
local socket = require ("socket.http")
end
main()
I get this error/message: module 'socket.http' not found:
no field package.preload['socket.http']
no file '/usr/local/share/lua/5.2/socket/http.lua'
no file '/usr/local/share/lua/5.2/socket/http/init.lua'
no file '/usr/local/lib/lua/5.2/socket/http.lua'
no file '/usr/local/lib/lua/5.2/socket/http/init.lua'
no file './socket/http.lua'
no file '/usr/local/lib/lua/5.2/socket/http.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './socket/http.so'
no file '/usr/local/lib/lua/5.2/socket.so'
no file '/usr/local/lib/lua/5.2/loadall.so'
no file './socket.so'
I'm working with lua in Windows and I have no idea of how to implement this.
I want to use LuaSocket to get an image from http repository and then get its base64 encoded, without downloading the image. This with an image in a filesystem, this solution works:
dofile("C:\\Users\\se47596\\Desktop\\LUA\\prueba2\\src\\Base64.lua")
imagen = "C:\\Users\\se47596\\Desktop\\LUA\\prueba2\\src\\pruebaAsyncOCR.png"
local function main()
imfh = io.open(imagen,'rb')
imblob = imfh:read('*a')
imfh:close()
print("ImageData="..enc(imblob))
end
main()
What files should I import to my Eclipse project? I saw these operations but I don't know how to use them...
--package.path = "./lua/modules/?.lua"
--package.cpath = "./lua/modules/?.dll"
--local socket = require ("socket")
how should I structure my project? At least I have this:
MyProjectFolder
|__src
|__Base64.lua
|__main.lua
Could you help me please? I want to prove it out of the Lua interpreter. I saw also these solutions, but I couldn't make it work in my Eclipse project, maybe I need a previous step.
Do I need to create a library? How could I do this in that case?
http://w3.impa.br/~diego/software/luasocket/installation.html
http://luarocks.org/
Best regards!
First error looks like you are running in Linux??
Have you successfully installed LuaSockets? Its written in C so you need a compiler to install it. That can be found in Microsoft developer tools. You can also use cygwin.
Alternatively if you have mingw installed you can first download:
https://github.com/pkulchenko/ZeroBraneStudio/blob/master/build/build-win32.sh
Then you can run:
bash ./build-win32.sh lua luasocket
I can build them by the way blow :
(1) replace gcc/g++ in build-win32.sh like thie:
GCC=x86_64-w64-mingw32-gcc
GPP=x86_64-w64-mingw32-g++
#gcc $BUILD_FLAGS
$GCC $BUILD_FLAGS
(2) apt-cyg cmake unzip mingw64-x86_64-gcc-g++
(3) bash ./build-win32.sh lua luasocket