ImportError when installing newspaper - python

I am pretty new to python and am trying to import newspaper for article extraction. Whenever I try to import the module I get ImportError: cannot import name images. Anyone come across this problem and found a solution?

I was able to fix this problem by creating an images directory in /usr/local/lib/python2.7/dist-packages/newspaper , moving images.py to this directory, and placing a blank __init__.py in this directory.

I know this is a dated entry, but to anyone else that faced the same issue as me, I initially fumbled with resolving this issue. When I first run import newspaper, I faced this error. lxml runtime error: Reason: Incompatible library version: etree.so requires version 12.0.0 or later, but libxml2.2.dylib provides version 10.0.0
When I tried to re-run my code (without correcting anything), I got the error found on this article. I have no idea why this was the case, and I wasn't able to resolve my issue using the above method (it didn't work for me, but it could still work for you). If anyone was fumbling like me on Jupyter on getting newspaper to work, do consider the link below. Hope this is helpful.
https://stackoverflow.com/a/31607751/6143792

Related

Whenever I try to import a python library I always get "ModuleNotFoundError" what do I do?

Whenever I try to import the libraries "beautifulsoup" or "requests" I always get the same error. The error I get looks like this... ModuleNotFoundError: No module named 'bs4'. I already have these libraries installed I just can't seem to figure out what's wrong.
If you look at the image below, I noticed when I use the recommended interpreter I get a problem saying "Import "bs4" could not be resolved from source". However, when I select one of the other Python 3.10.7 interpreters the problem goes away(see second picture). Either way I still get the Module not found error. I was thinking this info might help diagnose the problem I'm having.
I think you need to cross check environmental variable path of python and editor interpreter path
so, may be possible you downloaded that library but it available on another path for that he can't reach out and you get error

Why am I unable to run the .login() attribute for robin_stocks?

I'm trying to import data from Robinhood through robin_stocks. I was able to import the package, but when I try to use the .login() attribute, it returns this error message in the Jupyter Notebook: error
module 'robin_stocks' has no attribute 'login'
I'm certain that robin_stocks does, indeed have the attribute that Python is telling me doesn't exist. Where did I go wrong here?
I'm relatively new to programming, but usually I can find an answer to my questions pretty quickly on StackOverflow or any other resource. I can't seem to figure this one out, though.
Any help would be greatly appreciated. Thank you!
I had the same error when upgrading from 1.7.x to 2.0.3
I was able to solve this by changing the import from:
import robin_stocks as rs
To:
import robin_stocks.robinhood as rs
Check the version of the package that you are using. I actually had the same issue when I migrated to a new laptop and installed packages again. I turned out that a newer robin-stocks python package got installed and resulted in an attribute error for my previously functioning code. When I reverted back to the older version of the package (1.5.5) my code worked like a charm.
Bro, we can't guess what you has typed in your code, please link it to us.
But if you have some issues with basic method of module, i think some thing gone wrong with import

Getting an error in Python library Installation

Am getting the following and trying to install a new library in PyCharm. I have never came across this error before. I have tried going to google for a solution, but I can't find any that helps. The error is below
Error loading package list:unknown protocol: c
Please I need help to finish a project am working on.
You might need to set up a proxy in PyCharm. Here is a similar issue with details on JetBrains Comunity site:
Error Loading Package List

How to import .Net Classes in Python using Python.Net

I'm using Python.NET to create wrapper for iText.net (https://github.com/itext/itext7-dotnet).
The dll is named itext.kernel.dll and the python script is in the samne folder of all the itext dlls.
With Jetbrain dotPeek I see that itext.kernel has various namespaces; the namespace iText.Kernel.Pdf is what I need, in particular the public class PdfReader.
Here's what I'm doing (from the docs on https://pythonnet.github.io/):
import clr
clr.AddReference('itext.kernel')
sys.path.append(os.getcwd()) # the script is currently in the dll folder
from iText.Kernel.Pdf import PdfReader
But this gets me a "ModuleNotFoundError: No module named 'iText'" error.
I can't understand what it's wrong, can someone point me to the right direction? Thanks.
edit: I can import and use iTextSharp just fine, it seems iText7 has something different.
Well, long story short I really wanted this to work... and solved my issue!
I tried using older builds, and I found out that build 7.0.8 worked fine.
I compared it with build 7.1.11 (the one I was having problems with) using dotPeek, and noticed it has some references, namely BouncyCastle.Crypto, Common.Logging and Common.Logging.Core.
I did put them in the project folder, but still no dice... until I noticed I was using BouncyCastle.Crypto build 1.8.6, while the itext.kernel referred build 1.8.5! Replacing with that version solved the issue.
Basically the newer builds of iText7 have 3 referenced libs, that must be present in the exact same version (at least to be imoported by pythonnet).
I hope this can help someone that has issues similar to mine.

Python 2.7.9 troubles importing pysftp

I've been having troubles import pysftp. I currently have a server running some python scripts on a database, and decided to try and update this module which some of the scripts use. It broke a bunch of the scripts and then I had to go back and fix the versioning and to allow everything to function.
So far the only module I'm not able to import or use is pysftp. It throws the attached error. I've tried going into sites-manager and removing the files from there, however it has yet to help. Everything else has been working. Updating doesn't work either.
Any indication on how to resolve this error is greatly appreciated.
Error is:
ImportError: cannot import name util
I haven't been able to find a package called util to install. Please help! Attached link is of the trace.
http://imgur.com/a/9lQUj

Categories