How to install mtools by pip on Mac OS? - python

I followed this instruction to install mtools: https://github.com/rueckstiess/mtools/blob/develop/INSTALL.md. I tried both by pip and building from source but failed to launch it. I got below error when trying to launch mlaunch. I see this error relates to python and I am not familiar with python. Does anyone have any idea on this error?
$ mlaunch
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/bin/mlaunch", line 9, in <module>
load_entry_point('mtools==1.2.4.dev0', 'console_scripts', 'mlaunch')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 565, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2697, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2370, in load
return self.resolve()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2376, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/mtools-1.2.4.dev0-py2.7.egg/mtools/mlaunch/mlaunch.py", line 40, in <module>
raise ImportError("Can't import pymongo. See http://api.mongodb.org/python/current/ for instructions on how to install pymongo.")
ImportError: Can't import pymongo. See http://api.mongodb.org/python/current/ for instructions on how to install pymongo.

The error message in the trace states:
ImportError: Can't import pymongo. See http://api.mongodb.org/python/current/ for instructions on how to install pymongo.
This means that you are missing a dependency called pymongo to run mlaunch.
You can install pymongo by running the following command:
python -m pip install pymongo
For more information on how to install pymongosee the official documentation: https://api.mongodb.com/python/current/installation.html

Related

Python installing twarc using pip

i'm new to coding and hoping to get some advice. I am using macOs Big Sur Version 11.4
I am trying to install a package called twarc and ran the following within my terminal.
pip install twarc
when I run pip show twarc
I see the following:
**Name: twarc
Version: 2.1.2
Summary: Archive tweets from the command line
Home-page: https://github.com/docnow/twarc
Author: Ed Summers
Author-email: ehs#pobox.com
License: UNKNOWN
Location: /Users/cominocomputer/opt/anaconda3/lib/python3.8/site-packages
Requires: click, click-config-file, requests-oauthlib, click-plugins, python-dateutil
Required-by:**
whenever I run pip2 show twarc I see the following error:
File "/usr/local/bin/pip2", line 11, in <module>
load_entry_point('pip==21.1.2', 'console_scripts', 'pip2')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2434, in load
return self.resolve()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Python/2.7/site-packages/pip-21.1.2-py2.7.egg/pip/__init__.py", line 1, in <module>
from typing import List, Optional
ImportError: No module named typing
What I assume to be the error is that I have Python2 and Python3 installed. I also have pip2 and pip3. Twarc got installed into pip3 but is not working properly when I try to run a python file because perhaps my file is running on pip2?
Does anyone know how to resolve this issue?
I have tried pip2 install typing this does not resolve the issue.
Below is an image of the error i get in IDLE when trying to use "import twarc" within my .py
based on you module name in python registry name is [twarc][https://pypi.org/project/twarc/2.1.2/]
you should do pip install twarc==2.1.2

pip broken with this errer

$ pip install selenium
Traceback (most recent call last):
File "/usr/local/bin/pip", line 11, in <module>
load_entry_point('pip==21.0.1', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2843, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2434, in load
return self.resolve()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources/__init__.py", line 2440, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Python/2.7/site-packages/pip-21.0.1-py2.7.egg/pip/_internal/cli/main.py", line 60
sys.stderr.write(f"ERROR: {exc}")
^
SyntaxError: invalid syntax
I hope to install selenium to make crawling images, but this message makes me crazy. I can't googling this error as it is too long and I can't understand.
I tried to reinstall python with and pip with this code
$ curl -O https://bootstrap.pypa.io/2.7/get-pip.py
$ python get-pip.py
$ python -m pip install --upgrade "pip < 21.0"
I just started to study programming. Plz let me know what is wrong.
I just found what I did wrong.
I used pip instead pip3
With pip3, It works...
For someone in such a problem, I leave this post

Fabric ImportError: cannot import name 'isMappingType' with Python 2.7

I am trying to get Fab up and running locally. Why is Fab installing to /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5? The system Python version is 2.7.10, confirmed below:
Toms-MBP:~ tom$ which python
/usr/local/bin/python
Toms-MBP:~ tom$ python --version
Python 2.7.10
Toms-MBP:~ tom$ head -1 `which fab`
#!/Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5
Toms-MBP:~ tom$ fab
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/bin/fab", line 9, in <module>
load_entry_point('Fabric==1.11.1', 'console_scripts', 'fab')()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 558, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2682, in load_entry_point
return ep.load()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2355, in load
return self.resolve()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2361, in resolve
module = __import__(self.module_name, fromlist=['__name__'], level=0)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/fabric/main.py", line 13, in <module>
from operator import isMappingType
ImportError: cannot import name 'isMappingType'
you need this:
pip install fabric3
Its look like you aren't using a virtualenv configured previously, so I think that the system just uses the normal path to python which means to /Library/Frameworks/Python.framework/Versions/3.5/bin/python3.5 .
This error is usual when we try use Fabric with python3.x because Fabric has not been update to this version of python which is really sad.

Error after installing pip with easy install (on mac)

I tried to download pip with easy install but after installation whenever I type pip into the mac terminal it gives me this error:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 8, in <module>
load_entry_point('pip==7.0.3', 'console_scripts', 'pip')()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 271, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 2173, in load_entry_point
return ep.load()
File "/System/Library/Frameworks/Python.framework/Versions/2.5/Extras/lib/python/pkg_resources.py", line 1906, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
File "/Library/Python/2.5/site-packages/pip-7.0.3-py2.5.egg/pip/__init__.py", line 211
except PipError as exc:
^
SyntaxError: invalid syntax
and when I try to do pip install pyopengl, it gives me the same error. What do I do to fix this?
Modern pip works with Python 2.6 and higher. It seems you got Python 2.5, so you either need to upgrade Python or use older version of pip.
According to the documentation Python 2.5 was supported through v1.3.1 of pip.

broken easy_install and pip after upgrading to OS X Mavericks

Upgraded to OS X 10.9 Mavericks and installed XCode, Command Line Tools, XQuartz, etc. Trying to run a pip install now, but it says that the distribution is not found:
Traceback (most recent call last):
File "/usr/local/bin/pip", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2603, in <module>
working_set.require(__requires__)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: pip==1.4.1
So I tried to install pip with an easy_install. Turns out that's borked too:
Traceback (most recent call last):
File "/usr/local/bin/easy_install", line 5, in <module>
from pkg_resources import load_entry_point
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 2607, in <module>
parse_requirements(__requires__), Environment()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: setuptools==1.1.6
So some of the other threads say to reinstall setuptools with a sudo python ez_setup.py. It seems to work fine:
Installed /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/setuptools-1.1.6-py2.7.egg
Processing dependencies for setuptools==1.1.6
Finished processing dependencies for setuptools==1.1.6
But when running the easy_install pip, the same pkg_resources.DistributionNotFound: setuptools==1.1.6 error occurs. Anyone else have this problem? Any ideas how to fix this?
Install easy_install:
Download ez_setup.py module from https://pypi.python.org/pypi/setuptools
$ cd path/to/ez_setup.py
$ python ez_setup.py
Install pip:
$ sudo easy_install pip
try sudo python -m easy_install pip
I ran into a similar problem with git-review.
$ git review -s
Traceback (most recent call last):
File "/usr/local/bin/git-review", line 11, in <module>
sys.exit(main())
File "/Library/Python/2.7/site-packages/git_review/cmd.py", line 1132, in main
(os.path.split(sys.argv[0])[-1], get_version()))
File "/Library/Python/2.7/site-packages/git_review/cmd.py", line 180, in get_version
provider = pkg_resources.get_provider(requirement)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 197, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 666, in require
needed = self.resolve(parse_requirements(requirements))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pkg_resources.py", line 565, in resolve
raise DistributionNotFound(req) # XXX put more info here
pkg_resources.DistributionNotFound: git-review
The git-review team said it was a bug with pkg_resources that could be fixed with
sudo pip install --upgrade setuptools
This worked fine for me.

Categories

Resources