ModuleNotFoundError: No module named 'djangofeeds' - django

I have followed the sample code given in the task-cookbook Ensuring a task is only executed one at a time
That code uses
from djangofeeds.models import Feed
I do not know where to get the djangofeeds module from?

Generally if you want a package, you'd search https://pypi.org/ for it and follow the instructions you find.
In this instance there is a module here; https://github.com/operasoftware/django-feeds
This appears to be the same package. However it doesn't appear to be released to pypi.
So you could download it & add it to your project or install the package from the downloaded archive, instructions for that here; https://packaging.python.org/tutorials/installing-packages/#installing-from-local-archives

djangofeeds' actual package name is django-feeds, not djangofeeds.
Thereby you can install that package with pip install django-feeds.

Just install djangofeed, pip install django-feeds/djangofeeds or pip3 install django-feeds//djangofeeds if you're using python3.

Related

ROS Kinetic: No script named 'rosdep' although it is installed

I have a problem using ROS Kinetic in Ubuntu 16.04.
It was working normally but suddenly rosdep dissapeared while I was trying to configure the Turtlebot Simulator and the AR Drone Autonomy Package.
When I type sudo rosdep init it shows the next error
Traceback (most recent call last):
File "/usr/local/bin/rosdep", line 4, in <module>
__import__('pkg_resources').run_script('rosdep==0.11.5', 'rosdep')
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 739,in run_script
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1486, in run_script
pkg_resources.ResolutionError: No script named 'rosdep'
I tried to install rosdep manually with sudo apt-get install python-rosdep but it shows that python-rosdep is already the newest version (0.11.5-1)
I tried uninstalling ROS using sudo apt-get purge ros-* and sudo apt-get autoremove and installing it again.
And also reinstalling it using sudo apt-get install --reinstall ros-kinetic-desktop-full but no working.
I am following the instructions of the official
site .
Any idea of what can I do to solve this? Thanks
rosdep is actually completely independent from all the ros-** packages because it is used to install them, which is why reinstalling those packages didn't help.
My best guess would be that you used pip in addition to apt for something with rosdep, and now have 1.5 or 3 different versions of rosdep. Please try removing rosdep installed using apt completely:
apt-get purge python-rosdep and make sure that there are no errors when removing the package. If there are any, post them as comment here. Then, check all python import paths for a folder named rosdep, and remove them. You can find out your python import paths by running the following python script:
import sys
print sys.path
Then, you type which rosdep. If there is a rosdep binary anywhere, remove it. Then you can reinstall rosdep: sudo apt install python-rosdep.

eve-swagger ImportError: cannot import name add_documentation

I'm using for the first time eve-swagger and I tried to execute the example provided in the README.rst file with the error message:
ImportError: cannot import name add_documentation
I tried to grep add_documentation in the repository and seems to be not defined.
Is this function defined in other version of eve-swagger?
How can I update elements in the documentation at run-time?
Many thanks in advance for your help!
add_documentation is on 0.0.5 which is still in development (changelog). If you installed from PyPI (pip install eve-swagger) then you are on v0.0.4, which has no add_documentation available.
Either you wait for 0.0.5 to go live, or you install the development version, which you can do with:
pip install git+https://github.com/nicolaiarocci/eve-swagger

nltk module installation in pip through cmd

When I tried to run this command:
c:\python27\scripts\pip install nltk-3.2.1-py2.py3-none-any
I am getting the error:
no matching distribution found
Although i have installed nltk from
http://www.lfd.uci.edu/~gohlke/pythonlibs/#nltk
Kindly help.
I am working on Windows 8 64-bit Version
Installing new modules can be a nightmare if you are new to Python.First delete any old versions of NLTK if already installed. Open cmd navigate to C:\Users\user\AppData\Local\Programs\Python\Python35-32\Scripts, the default directory, using the command cd path_name_comes_here. Otherwise goto the path where you have installed python and goto the Scripts subfolder and use this path here onwards. Now the most preferred way is to use pip install module_you_want_to_install for anything in python. Pip automatically fetches everything it needs to install said module.
Simply use pip install nltk.
Another method is to use easy_install requirement_or_URL.
Some rare occasions its best to download the wheel from http://www.lfd.uci.edu/~gohlke/pythonlibs and from there you can simply use pip install downloaded_wheel_name again. But make sure to copy the name of the wheel EXACTLY.
Post installation make sure that your package is accessible from C:\Users\user\AppData\Local\Programs\Python\Python35-32\Lib\site-packages or a similar path depending on where you installed python.
Try Anaconda - Instead . Always works
C:\Users\sanan>conda install -c anaconda nltk
Fetching package metadata .............
Solving package specifications: .
Package plan for installation in environment C:\Users\sanan\Miniconda3:
The following NEW packages will be INSTALLED:
nltk: 3.2.4-py36_0 anaconda
The following packages will be UPDATED:
conda: 4.3.23-py36_0 --> 4.3.25-py36_0 anaconda
The following packages will be SUPERSEDED by a higher-priority channel:
conda-env: 2.6.0-0 --> 2.6.0-0 anaconda
Proceed ([y]/n)? y
conda-env-2.6. 100% |###############################| Time: 0:00:00 22.84 kB/s
nltk-3.2.4-py3 100% |###############################| Time: 0:00:02 774.24 kB/s
conda-4.3.25-p 100% |###############################| Time: 0:00:00 578.90 kB/s
After installation is complete .
import nltk
print(nltk.__version__)
C:\Public\Code\textnorm>python attempt1.py
3.2.4

Using Point Cloud Library in Python

Hello I am trying to use Point Cloud Library in Python and as I am new to this C++ library and Python I am following the tutorial on http://strawlab.github.io/python-pcl/#pcl.PointCloud
However whenever I try to import pcl and define a module such as pcl.PointCloud() I get the following error;
AttributeError: 'module' object has no attribute 'PointCloud'
I have used sys.path.append to point to the correct directory where the PCL files have been installed as they are not in site packages. It says on the above link that the C++ code has already got Python bindings but I am unsure exactly what files I am trying to call in Python. Does anybody know how to overcome this error and load these modules?
Thanks,
Andrew
Try this,
sudo add-apt-repository ppa:sweptlaser/python3-pcl
sudo apt update
sudo apt install python3-pcl
After you've done that then you should be able to run:
python3 -c 'import pcl'
and it will return with no error (as opposed to ModuleNotFoundError: No module named 'pcl').
Tested on:
Ubuntu 18.04 LTS
Python 3.6.9
Reference: https://askubuntu.com/a/1170661/922137
Try skipping the parentheses:
from pcl import PointCloud
And then create an instance of PointCloud, for example, p:
p = PointCloud()
Hope it helps!
Looks like you need PCL 1.5.1 and cython 0.16 according to this page: http://strawlab.github.io/python-pcl/
"""https://blog.pollithy.com/python/numpy/pointcloud/tutorial-pypcd"""
python3.6 -m pip install --user git+https://github.com/DanielPollithy/pypcd.git

ImportError: No module named twisted.internet

I installed python 2.7.5 which is working fine.
I then install scrapy (which, I think, uses twisted internally). My scrapy spider is also working fine.
I installed twisted:
sudo apt-get install python-twisted
Then, I created a sample program using Echo Server code shown here
Here is the code
from twisted.internet import protocol, reactor
class Echo(protocol.Protocol):
def dataReceived(self, data):
self.transport.write(data)
class EchoFactory(protocol.Factory):
def buildProtocol(self, addr):
return Echo()
reactor.listenTCP(1234, EchoFactory())
reactor.run()
I try to run this code using this command:
$ python twistedTester.py
Traceback (most recent call last):
File "twistedTester.py", line 1, in <module>
from twisted.internet import protocol, reactor
ImportError: No module named twisted.internet
Can anyone help me with how I can debug why my twisted package is not being picked up by Python installation?
If you use pip just try:
pip install twisted
The same works with w3lib and lxml.
On some *nix systems this might give you a permission error. If that happens, try:
sudo -H pip install twisted
I figured out why this error was happening. For some reason, using apt-get to install a python package was not installing it right.
So, I had to download a tar ball and install the package from them.
I downloaded Twisted tar from here.
I did a tar xjf Twisted-13.1.0.tar.bz2 - this created a directory called Twisted-13.1.0
next, cd Twisted-13.1.0
Finally, python setup.py install
This gave me an error. Twisted required another package called zope.interface. So, I downloaded tar ball for zope.interface from here. Then, ran this command tar xzf zope.interface-3.6.1.tar.gz That created a folder called zope.interface-3.6.1. So, cd into zope.interface-3.6.1 and run python setup.py install
Note: Depending on your user's rights, you may want to do these commands in sudo mode. Just add the keyword sudo before every command.
please rename the file twisted.py to something else. whenever you import a function from a file the interpreter will search for the file in the current location and then it searches in the library. so if you have any file in the name of "twisted.py" you should probably rename it.
after renaming it. dont fail to remove the twisted.pyc file before running it again.
It happened to me too. Finally I figure out that there is a file named twisted.py my present working directory. I removed twisted.py and twisted.pyc. Problem resolved.
Looks like Twisted may have removed the twisted.internet module from the current release. Pinning on the version required by scrapy (17.9.0) worked for me:
$ pip install twisted==17.9.0
Checking if it's installed:
$ python -c "import twisted.internet; print(twisted.internet)"
<module 'twisted.internet' from '/Users/username/dev/env/redacted-ewmlD2h2/lib/python3.7/site-packages/twisted/internet/__init__.py'>
I figured out why apt-get install python-twisted was not enough or "installing it right", as you said, user1700184.
I use Debian Wheezy and Python 2.7.
I just had to move the folder named "twisted" from /usr/lib/python2.7/dist-packages/ to /usr/lib/python2.7/
The same has to be done with the package "zope" and any other one that you do install but is not retrieved when you try run your code.
However, why this is even necessary in my case is still a mystery since my sys.path does include both /usr/lib/python2.7/ and /usr/lib/python2.7/dist-packages, so whatever was under dist-packages should have been retrieved by the interpreter.
I think it is worth noting that if you use sudo to launch python you are using your original default system python. This is NOT the python that your PATH points to. For example if you are using Anaconda and you have updated your path such that which python points to path/to/anaconda/bin/python, sudo which python will still point to usr/bin/python.
So obviously sudo python twistedTester.py will not find the twisted module. To get around this you should explicitly pass the path to the anaconda python. Like so:
sudo path/to/anaconda/bin/python twistedTester.py