I have been struggling to install a third party module for mac.
I spotted a similar question, (What is the most compatible way to install python modules on a Mac?)
However I'm getting a syntax error when following this advice.
Could anyone help me out?
You are running Python 3.5 according to the image
pip is already available, no need to install it again.
You need to not be within the python interpreter REPL
Related
I am trying to compile my python program into an android APK file. I installed the package 'python-for-android'. when i tried to use it, i go an error saying C:\Program Files\Python39\python.exe: No module named python-for-android. Can someone please tell me what is going wrong?
https://pypi.org/project/python-for-android/
It looks like it is being installed into a different location than where you pip installed the library. If you can give more details about how you installed the package, it might help identify the issue.
Is it possible that you have two python versions, and it installed it into the wrong version.
Using virtual environments might make it easier to understand what is going on. If you pip install into a virtual environment, you can be pretty confident that it is installing into the correct version of python.
I did a pip install chatterbot.
and I imported the same in a python program which while running showed a
module not found error.
Can you confirm that the pip install initially worked without any errors? If there was an issue there, it is likely due to the module name that you're using.
If that's not the case, do you know which version of python you're using? The problem may be that you're using python 3. In which case try pip3 install chatterbot instead.
First, check if this module really exists in system using pip freeze. If it shows your module installed, then check for correctness in import string, and make sure that your pip points to the interpreter you're using. If you're using venv, it must also be taken account for.
Second, take note that the chatterbot.ChatBot needs to be imported like
from chatterbot import ChatBot, not just import ChatBot.
Best of luck!
Do you use Windows or Linux?
If you use Windows. Did you set the enviroment variables?
I'm working with Concept Drift, but when trying to run my code i get this error
"ImportError: No module named detector_classifier" been trying to install the module with pip install, but all i get is no match found. Anyone had this problem before?
Before you can import third party libraries, you need to install first. If you could not install with pip install, it means it's not published on PyPI. You need to install directly from source where you found code/module for Concept Drift or detector_classifier, or whatever you're trying to use.
I think a little more information might help. Which python version and which pip version are you using? I just googled "detector_classifier" and couldn't find anything. What library does "detector_classifier" belong to?
Without much background to go off of, I would recommended making sure you have updated pip. Depending on what operating system you're using, your configuration might need some tinkering so your system knows where to look.
I'm in the process of trying to install rpy or rpy2 on my Macbook so I can use R from python. Information about rpy can be found here: http://rpy.sourceforge.net/index.html
My problem is in the installation itself. I can't seem to make python recognize Rpy using import command: I keep getting the message "No module named rpy2". Does anyone know where I can find some step-by-step instructions on how to successfully install this? I have already installed both python and R, and both are working perfectly. Thanks in advance!
Try easy_install rpy2. You need to install easy_install before that.
I took that from here
I long gave up on these issues on my Mac. Since I installed OS Lion, I found that I needed to switch to MacPorts and then installing packages like RPy2 from their repository.
I know some people like to dig into the system and learn all the idiosyncrasies of the architecture and keep a vanilla install of python on their Mac. I find that i get problems like yours too frequently and they distract me from real work.
I just download the MacPorts modules when I need them and get on with the problem at hand. Others say the same thing about HomeBrew but I have only worked with MacPorts and it makes installation of modules too easy. You may want to invest some time investigating if either of these solutions work for you.
Another approach to using package managers like MacPorts or HomeBrew is to use a virtualenv and install python and all related modules there. Again, not a solution I have tried directly, but a quick search will show you many endorsements for this approach to using a specific Python executable and packaging its modules In an isolated environment.
as long as you have pip installed on your mac, then life will be easy as:
sudo pip install rpy2
If you want rpy it isn't on macport, at least a search of their packages only showed rpy2. According to the rpy web site its in fink. However at the moment fink is down so I can't verify this. Which is irritating because I need rpy (not rpy2) because another package has a dependency on it.
I also tried pip to find rpy and it said no package, which is a shame because pip is great for python installs (provided I remember to use 'sudo' first.
I'm running OS X Leopard. I followed this site to install it. Trying to run any demo script, I now get "No module named opencv.cv", which is obviously stopping me from doing any programming. I am running python 2.5.1 (yes, I know it's kind of old).
Why would this be, and how can I solve it?
Thanks
You need to compile openCV unfortunately. It's not that hard to do though at least.
A nice route is to use MacPorts: First, be sure to have py26-numpy installed to have support for basic functions such as cv.fromarray :
sudo port install py26-numpy
Then, opencv will compile (with no problem on my side):
sudo port install opencv +python26
Your link tells to install OpenCV with MacPorts, which currently installs version 2.2.0. The API was changed for 2.2, so that might be the reason opencv.cv doesn't exist (also your link is written for the ancient 1.0). OpenCV changelog explains it:
http://opencv.willowgarage.com/wiki/OpenCV%20Change%20Logs
It isn't clear to me how up-to-date the OpenCV documentation is nowadays but I recommend looking at it:
http://opencv.willowgarage.com/documentation/python/index.html
(Python examples there begin with import cv)