Error installing Firefox 'marionette_driver' python package - python-3.x

Error installing Mozilla automation client 'marionette_driver'.
Mozilla documentation says to install with the following command:
$ pip install marionette_driver
This produces an error:
Collecting marionette_driver
Downloading marionette_driver-2.2.0.tar.gz
Collecting mozrunner>=6.13 (from marionette_driver)
Downloading mozrunner-6.13.tar.gz (67kB)
100% |████████████████████████████████| 71kB 1.5MB/s
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-0829rk11/mozrunner/setup.py", line 24, in
<module>
assert sys.version_info[0] == 2
AssertionError
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in
/tmp/pip-build-0829rk11/mozrunner/
These variations of the pip install command produce the same error.
$ sudo pip install marionette_driver
$ sudo -H pip install marionette_driver
$ pip3 install marionette_driver
$ sudo pip3 install marionette_driver
$ sudo -H pip3 install marionette_driver
(debian systems seem to require pip3 to install python3 packages, while it has been suggested the egg_info error can be avoided by using sudo -H. seems to make no difference.)
I have both Python 2.7 and 3.5 installed. I would normally expect pip to install python 2 packages. But I use 3.5, so what do I know? Anyway, the same error occurs using pip and pip3.

The error occurs when you install the mozrunner dependency of marionette_driver. The error message indicates that it is checking that it is running on Python version 2.x (assert sys.version_info[0] == 2), which fails as you would expect. Unfortunately, at time of writing, there is not Python 3 compatible version of mozrunner, so it looks like you will not be able to install marionette_driver for Python 3.
If you are using virtual environments (e.g. with virtualenv, anaconda, or similar), you should be able to create a Python 2 environment and install it there with pip.
Also, on most Unix-like systems, you can install both Python 2 and 3. Usually, the executables will be called python2 and python3, with one of them sym-linked to the default python. The same goes for the corresponding pip2 and pip3 executables. You may have better luck running your installation via pip2, if you have Python 2 installed on your system.

Related

ModuleNotFoundError: No module named 'uaclient.entitlements' dpkg: error processing package ubuntu-advantage-tools (--configure):

Whenever i try sudo apt-get upgrade or try to install any other package i get the above error. Is there any way to solve it?? Using ubuntu 16.04
Removing python3-distro-info (0.14ubuntu0.2) ...
Setting up ubuntu-advantage-tools (27.0~16.04.1) ...
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'uaclient.entitlements'
dpkg: error processing package ubuntu-advantage-tools (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
You should install opcua and opcua-client with default python command:
python -m pip install --upgrade opcua
python -m pip install --upgrade opcua-client
I have the same problem and try to solve then it work for me.
My environment:
OS: ubuntu 18.04 LTS
python version: 3.6.9(system default) , manual
install 3.8.7
System python path have been link to python 3.8 when I install python 3.8, so any process use python will call python 3.8 and use pip3.8 site-packages, not use system dist-packages(python 3.6). But python 3.8 uaclinet(install by pip) is different from uaclinet in dist-packages(ubuntu-advantage-tools provide). then I use apt upgrade
設定 ubuntu-advantage-tools (27.0.2~18.04.1) ...
Traceback (most recent call last):
File "<string>", line 2, in <module>
ModuleNotFoundError: No module named 'uaclient.entitlements'
dpkg: error processing package ubuntu-advantage-tools (--configure):
installed ubuntu-advantage-tools package post-installation script subprocess returned error exit status 1
處理時發生錯誤:
ubuntu-advantage-tools
E: Sub-process /usr/bin/dpkg returned an error code (1)
So, I copy the uaclinet(in dist-packages) to python 3.8 site-packages and run upgrade again, then it works( maybe has compatibility problems )
設定 ubuntu-advantage-tools (27.0.2~18.04.1) ...
W: APT had planned for dpkg to do more than it reported back (0 vs 4).
Affected packages: ubuntu-advantage-tools:amd64
I think if your use system python , you can use comment by Jan Wilamowski,
This problem appeared for me after upgrading to Ubuntu 18.04 from 16.04.
I updated opcua and opcua-client as suggested with python -m pip install, and also with pip3 install, to get it updated in python3 packages, and the problem remained.
I have system python3 installed in /usr/bin/python3 (version 3.6), and another version in /usr/local/bin/python3 (version 3.8) which is the default python3. I'm not sure why, but the uaclient.entitlements module can be loaded properly with /usr/bin/python3, but not with /usr/local/bin/python3
Instead of changing the location of the uaclient package, the following worked for me:
I used update-alternatives to choose which python3 will be used by default, either system python3 which is /usr/bin/python3.6, or the updated python3 which is installed in /usr/local/bin/python3.8 as described here:
https://unix.stackexchange.com/questions/410579/change-the-python3-default-version-in-ubuntu
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/local/bin/python3 python3 /usr/local/bin/python3.8 2
Then, choose /usr/bin/python3.6 as the default by running:
sudo update-alternatives --config python3
A symlink is created as /etc/alternatives/python3 that points to the chosen default python3.
Since the way I set the alternatives results in /usr/local/bin/python3.8 as the automatic default python3, the symlink /usr/bin/python3 -> python3.6 is removed. But this symlink is still needed for dependencies/functions that use system python through /usr/bin/python3, so I added back the sym link:
sudo ln -s python3.6 /usr/bin/python3
By setting /usr/bin/python3.6 as the default instead of /usr/local/bin/python3.8, then uaclient.entitlements can be loaded properly. This worked for me to install and upgrade packages where this uaclient.entitlements ModuleNotFoundError was occurring. Just have to switch back to using /usr/local/bin/python3.8 when finished installing. But I think now that ubuntu-advantage-tools is configured by getting through this error, there doesn't seem to be a need to switch to /usr/bin/python3.6 as the default anymore for installing packages.
The answer in https://askubuntu.com/questions/1336425/no-module-named-uaclient-during-sudo-apt-upgrade-ubuntu-16-04 worked for me. Basically, I modified manually the post-installation and pre-remove script in /var/lib/dpkg/info/ubuntu-advantage-tools.postinst and /var/lib/dpkg/info/ubuntu-advantage-tools.prerm and replace python3 with the complete path /usr/bin/python3.5, and then the 'apt-get upgrade' didn't fail as before.
If you are not going to use ubuntu advantage tools then
sudo dpkg --remove --force-remove-reinstreq ubuntu-advantage-tools
but even tat failed for me... I had to
sudo rm /var/lib/dpkg/info/ubuntu-advantage-tools.prerm
because this script was blocking uninstall
i have tried to install:
python -m pip install --upgrade opcua
python -m pip install --upgrade opcua-client
but even that was failing for me on a second - client installation
finally after about 6 months I can do ubuntu update without error reporting.

My Python set-up is too complicated, and I don't understand it. Currently my Python is unusable. Advice would be welcome

Here is a sequence of my commands, and my system's response. This shows that I do not know how to access numpy with my current (very confusing) Python setup. It was recently working, but then I changed something, but can't remember what.
I run MacOs 10.14.6 on a Macbook Pro.
dbae$ which $SHELL
/bin/bash
dbae$ bash --version
GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin18)
Copyright (C) 2007 Free Software Foundation, Inc.
dbae$ echo $PATH
/Users/dbae/bin:/opt/local/bin:/opt/local/sbin:/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/bin:/usr/local/texlive/2018/bin/universal-darwin:/usr/local/texlive/2018/bin/x86_64-darwin:/Library/TeX/texbin:/opt/X11/bin:/Users/dbae/Library/Python/3.7/bin:/Library/Frameworks/Python.framework/Versions/3.7/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:
dbae$ python run.py
Traceback (most recent call last):
File "run.py", line 9, in <module>
import numpy
ModuleNotFoundError: No module named 'numpy'
dbae$ which python
/opt/local/bin/python
dbae$ /opt/local/bin/python --version
Python 3.8.3
dbae$ which pip
/opt/local/bin/pip
dbae$ /opt/local/bin/pip --version
pip 19.3.1 from /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6)
dbae$ pip install --upgrade pip
Collecting pip
Using cached https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl
Installing collected packages: pip
Found existing installation: pip 19.3.1
Uninstalling pip-19.3.1:
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/opt/local/Library/Frameworks/Python.framework/Versions/3.6/bin/pip'
Consider using the `--user` option or check the permissions.
dbae$ pip install numpy
Requirement already satisfied: numpy in /opt/local/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (1.17.4)
Actually, you kind of screwed your pip setup. Start with the beginning :
$ python -m pip list
What is returned by this command ?
I would suggest you start using virtual environment (venv). It is much easier to handle module dependency issues in the future.
$ python -m venv /path/to/env
$ source /path/to/env/bin/activate # Activates your environment
$ python -m pip install numpy
$ python run.py
Doing so will gather all your dependencies in /path/to/env without messing up with your global setup.

Unable to install bottle-memcache in ubuntu using pip3 with python3.6 [duplicate]

I have installed pip for python 3.6 on Ubuntu 14. After I run
sudo apt-get install python3-pip
to install pip3, it works very well. However, after installation, when I am trying to run
pip3 install packagename
to install a new package, something strange occurs:
File "/usr/lib/python3/dist-packages/pkg_resources.py", line 1479, in <module>
register_loader-type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module "importlib._bootstrap" has no attribute "SourceFileLoader"
It seems that I did nothing wrong, and I really cannot figure out the reason.
If you're getting this error running pip install dotenv, this is because the package is called python-dotenv not dotenv.
This worked for me:
sudo pip install python-dotenv
Faced the same problem. I think this is because python3.6 and pip3 were installed from different sources.
I suggest using python's inbuilt facility to install pip i.e
python3 -m ensurepip --upgrade
This should install pip3 and pip3.x where x in python3.x.
Same works for python2 also.
Tried to install Tensorflow in venv on Windows 10 machine with python 3.8 and got the same issue.
What helped for me was:
pip install setuptools --upgrade
I had the same problem on my ubuntu 18.04 with python 3.6. None of the above methods helped, but this one solved the problem:
pip3 uninstall setuptools
I had the same error whatever I asked to pip. I gave a look to this page: https://packaging.python.org/tutorials/installing-packages/
That line is the one that solved my problem:
python3 -m pip install --upgrade pip setuptools wheel
pip install setuptools --upgrade
This command solved my issue. It fixed my problem.
When updating from python3.4 to python3.6 on ubuntu 14.04. The following solved me:
wget https://bootstrap.pypa.io/ez_setup.py -O - | python3
If you face this issue in anaconda environment, simply upgrade setuptools using the following:
conda install -c conda-forge setuptools
That's because you are using an old version of setuptools, check up this issue.
I met the same problem, this is the key:
curl -sS https://bootstrap.pypa.io/get-pip.py | sudo python3
I had faced the same issue on Ubuntu 19.10 and now I upgraded to Ubuntu 20.04 and faced the issue again. This issue is due to broken pip3. So whenever you enter pip3 and hit enter it will show the same error. So instead of using "pip3 uninstall setuptools" use the below code
python3 -m pip uninstall setuptools
It resolved my issue 3rd time
I am facing the same problem, which is solved by downloading the source files of the setuptools and installing the module manually.
The setuptools can be downloaded here:
https://pypi.org/project/setuptools/
After downloading, unzip the package first, then cd to the directory and run
python setup.py install --user
For me the error happened while trying to create a virtual env with python 3.8:
sudo virtualenv venv -ppython3.8
And after trying all the answers here, finally the problem solved by installing the new version of virtualenv (20.0.7):
sudo pip3 install virtualenv
I encountered this error message triggered by a slightly different situation which I'll mention here for anyone who finds this.
This same error also occurs when installing the distribute Python package (which is currently just a compatibility layer in front of setuptools) in Python 3.6 or newer.
In my specific situation I discovered this as I was using pyzmail which has been somewhat abandoned and depends on distribute.
Collecting distribute
Downloading distribute-0.7.3.zip (145 kB)
ERROR: Command errored out with exit status 1:
command: /var/lang/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ssqyqflj/distribute/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ssqyqflj/distribute/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-hgbjn0js
cwd: /tmp/pip-install-ssqyqflj/distribute/
Complete output (15 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/__init__.py", line 2, in <module>
from setuptools.extension import Extension, Library
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/extension.py", line 5, in <module>
from setuptools.dist import _get_unpatched
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/dist.py", line 7, in <module>
from setuptools.command.install import install
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/command/__init__.py", line 8, in <module>
from setuptools.command import install_scripts
File "/tmp/pip-install-ssqyqflj/distribute/setuptools/command/install_scripts.py", line 3, in <module>
from pkg_resources import Distribution, PathMetadata, ensure_directory
File "/tmp/pip-install-ssqyqflj/distribute/pkg_resources.py", line 1518, in <module>
register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
I had the same issue when I tried to install the Slate package in Windows 10, Python 3.7.4 version:
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
The instruction that generated the error:
C:\WINDOWS\system32>python -m pip install slate
The instruction that worked:
C:\WINDOWS\system32>python -m pip install https://github.com/timClicks/slate/archive/master.zip
I had the same problem with my cloud computer. If all above didn't work for you don't worry. Here's how I resolved it:
Download the pip file (pip-version.tar.gz) from:
https://pypi.org/project/pip/#files
For cloud, use this
curl https://files.pythonhosted.org/packages/8e/76/66066b7bc71817238924c7e4b448abdb17eb0c92d645769c223f9ace478f/pip-20.0.2.tar.gz --output pip.tar.gz
Extract the content of the file and cd into the directory.
Run the following in the directory
python3 setup.py install --user
You should have pip3 working without errors.
pip3 install setuptools --upgrade
This also cured the issue on Python 3.9 running on Windows 10 and even on a custom Docker image.
I was having the same issue while using docker-compose. This exact error can be caused by not being the root user. Running the same commands with sudo fixed it for me. I don't not have setup-tools installed, and I'm running pip3. My issue was that IntelliJ didn't have sudo rights, so i had to do it from the terminal.
Above solutions were not working in my case for Ubuntu 20
If you run the following command:
sudo apt install python3-setuptools
Then you might get the result:
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-setuptools is already the newest version (45.2.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
But to actually solve it and re-install setuptools try following commands:
sudo apt download python3-setuptools
sudo dpkg -i python3-setuptools_45.2.0-1_all.deb
Note: Change the version of the python package that is downloaded
Traceback (most recent call last):
File "/usr/bin/pipenv", line 6, in <module>
from pkg_resources import load_entry_point
File "/home/myuser/.local/lib/python3.7/site-packages/pkg_resources.py", line
1479, in <module>
Mine looked pretty similar, but for some reason I had a python installation in my home directory .local folder.
I did some of the other answers in this thread to ensure I had good local copy of python, then did:
rm -rf ~/.local
Just go inside the /usr/lib/python3/dist-packages/, first copy setuptools file somewhere and then delete the setuptools. Everything will be okay for deleting you can use:
sudo rm -r setuptools
for copying
sudo cp -r setuptools /...Desktop/
After that if it gives errors just:
sudo pip3 install setuptools==3.8.1
to download again.

Command "python setup.py egg_info" failed with error code 1 when installing 'pattern

Am trying to install pattern on python 3.6 with the command prompt using:
pip3 install pattern
But am getting this error :
C:\WINDOWS\system32>pip3 install pattern
Collecting pattern
Using cached pattern-2.6.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\HP\AppData\Local\Temp\pip-build-u_5lhmfa\pattern\setup.py", line 40
print n
^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print(int n)?
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\HP\AppData\Local\Temp\pip-build-u_5lhmfa\pattern\
By the way I have Python 2.7 installed as well and when I installed with pip2 install pattern, it perfectly installed.
The problem is with python 3.6. How can I fix this?
Pattern-2.6 at PyPI seems to be rather old (last updated in 2014). They require Python 2.5+. I think the code is Python2-only, you cannot use it with Python 3.
Pattern3 seems to be the package for Python 3:
pip install pattern3
I don't know how but this really worked for me:
Running command prompt as an administrator then :
pip3 install git+https://github.com/clips/pattern#development
This install pattern as more packages.
Am posting this in case it would help anyone
More details :["pattern" package for python 3.6 Anaconda ]
Python3 support is as discussed in this issue: https://github.com/clips/pattern
From pip install from git repo branch
pip install -U https://github.com/clips/pattern/archive/development.zip

pip3 works with python3.2 but won't work with python3.3

I have created a virtual environment for python3
virtualenv -p /usr/bin/python3 myenv
Everything works ok and pip installs python3 packages. Then I need to upgrade my python3.2 to python3.3. I am using ubuntu 12.04, so I need to do what Luper Rouch suggests here through ppa
I copy /usr/bin/python3.3 into myenv/bin/python3, thus (inside myenv):
python --version
returns Python 3.3.5. But then pip stops working failing with
pip install urllib3
Traceback (most recent call last):
File "mypathtoevn/bin/pip", line 7, in <module>
from pip import main
ImportError: No module named 'pip'
Then I understand that I have to use
pip3.3 install <package_name>
but I can't find any other pip*.* version either globally or inside virtualenv in my system.
How can I get pip3.3 or any other pip version?
Thanks
The ppa you have installed does not contain pip. The python package installer is itself installed with easy_install. On the question you linked to follow the later parts of this answer
Basically, calling
wget http://python-distribute.org/distribute_setup.py
python distribute_setup.py
easy_install pip
should be sufficient. You should use the easy_install command of your Python3.3 install.
Check with
which python
where your python comes from, and search for easy_install in that path. In your case you know where it resides: Your virtualenv.

Resources