Error in pdfminer library installation in conda environment - python-3.x

I installed "pdfminer" in virtual environment of conda.
I installed and reinstalled the library with following commands :
conda install -c conda-forge pdfminer
conda install -c conda-forge/label/cf201901 pdfminer
conda install -c conda-forge/label/cf202003 pdfminer
I got the same error all the time. It was like this:
/home/hamza/anaconda3/envs/my/bin/python /home/hamza/PycharmProjects/practice/pdf_info.py
20191125
Traceback (most recent call last):
File "/home/hamza/PycharmProjects/practice/pdf_info.py", line 67, in <module>
from pdfminer.high_level import extract_text
File "/home/hamza/anaconda3/envs/my/lib/python3.7/site-packages/pdfminer/high_level.py", line 14, in <module>
from .utils import open_filename
ImportError: cannot import name 'open_filename' from 'pdfminer.utils' (/home/hamza/anaconda3/envs/my/lib/python3.7/site-packages/pdfminer/utils.py)
Process finished with exit code 1
Is there any alternate way to install this library or what we can do this resolve this error

Related

Spyder won't start in cmd

When I try to run spyder (any version of spyder) in cmd I get the error below.
Traceback (most recent call last):
File "C:\Users\bjwil\Anaconda3\Scripts\spyder-script.py", line 10, in <module>
sys.exit(main())
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\spyder\app\start.py", line 186, in main
from spyder.app import mainwindow
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\spyder\app\mainwindow.py", line 87, in <module>
from qtpy import QtSvg # analysis:ignore
File "C:\Users\bjwil\Anaconda3\Lib\site-packages\qtpy\QtSvg.py", line 14, in <module>
from PyQt5.QtSvg import *
ImportError: DLL load failed: The specified procedure could not be found.
I do not get this error when run spyder in MinGW Git for Windows. I have looked for a few hours but cannot seem to find answer to why. I have the python3.dll and python36.dll extension from Anaconda3 in the Anaconda3 folder. I also cannot uninstall PyQt5 (getting PackagesNotFoundError: The following packages are missing from the target environment:
- pyqt5) and reinstall using either conda install -c dsdale24 pyqt5 or conda install --channel https://conda.anaconda.org/bpentz pyqt5. I get:
Collecting package metadata: done
Solving environment: failed
UnsatisfiableError: The following specifications were found to be in conflict:
- conda[version='>=4.6.7']
- pyqt5
Use "conda search <package> --info" to see the dependencies for each package.
conda update --all fixed the same issue for me.
There may different reason for this problem. Sometimes it is because you forget to install spyder in the anaconda environment.
You can install Spyder from anaconda prompt by running
conda install spyder
Also, you can install spyder by going to the anaconda navigator.

ImportError: No module named 'pymysql.cursors'

I am beginner in python and want to use database.I have followed following link for database access.
steps
The output of steps which i has used as following :
Command
pip3 -V
Result
pip 18.1 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)
Second Command
pip3 install PyMySQL
Result
Requirement already satisfied: PyMySQL in /usr/local/lib/python3.5/dist-packages/PyMySQL-0.9.2-py3.5.egg (0.9.2)
While i was using script to access database i got following error.
Traceback (most recent call last):
File "pymysql.py", line 2, in <module>
import pymysql.cursors
File "/var/www/cgi-bin/pymysql.py", line 2, in <module>
import pymysql.cursors
ImportError: No module named 'pymysql.cursors';
`enter code here`'pymysql' is not a package
Environment :
OS - Ubuntu 16.04
Python version - Python 3.5
Try the below command,
python3 -m pip install PyMySQL

Can't import Chem from rdkit in Anaconda Python 3.6.5

I install the Anaconda 4.5.4 with Python 3.6.5 and install rdkit (with command "conda install -c rdkit rdkit") and I'm trying to import the Chem and does not works.
from rdkit import Chem
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/wandre/anaconda3/envs/flaskapp/lib/python3.6/site-packages/rdkit/Chem/__init__.py", line 25, in <module>
from rdkit.Chem.rdmolops import *
ImportError: libXrender.so.1: cannot open shared object file: No such file or directory
How can I fix this? Where is my error?
Thanks!
Just run sudo apt-get install libxrender1 and it works

Issues installing Tweepy on Ubuntu

I'm trying to install Tweepy on an Ubuntu VM and I'm running into way more issues than I should be. My first step was to successfully get pip installed. After that I tried:
pip install tweepy
which returns:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3020, in <module>
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 616, in _build_master
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 629, in _build_from_requirements
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 807, in resolve
pkg_resources.DistributionNotFound: pip==1.5.4
The most that I can gather from that error message is that it can't find pip version 1.5.4. However, if I ask it whereis pip it returns:
pip: /usr/local/bin/pip2.7 /usr/local/bin/pip /usr/share/man/man1/pip.1.gz
So I know pip is installed. I decided to try the other method listed and do
git clone https://github.com/tweepy/tweepy.git
cd tweepy
python setup.py install
But that only seems to partially install with error messages returning. Trying whereis tweepy after that method returns nothing.
Can anyone make sense of why this simple install isn't working for me?
This issue was resolved by using another fresh Ubuntu VM install and once again trying the manual installation by using
git clone https://github.com/tweepy/tweepy.git
cd tweepy
python setup.py install
For whatever reason, it now works. The answer is officially voodoo.

Python3.2 - ImportError: No module named setuptools

When I run "sudo python3.2 setup.py install" I repeatedly get the error below
Traceback (most recent call last):
File "setup.py", line 3, in module
from setuptools import setup
ImportError: No module named setuptools
I've installed setuptools using apt-get, removed it & then manually installed by doing the following:
wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.x.tar.gz
tar zxvf setuptools-0.x.tar.gz
cd setuptools-0.x
python setup.py build
python setup.py install
I can't figure out why I'm still getting the error after repeated installations?

Resources