Still for some reason without being root I am unable to run pip or pip3.
~]: pip list
Traceback (most recent call last):
File "/usr/bin/pip", line 7, in <module>
from pip import main
ImportError: cannot import name 'main'
~]: pip3 list
Traceback (most recent call last):
File "/usr/bin/pip3", line 7, in <module>
from pip import main
ImportError: cannot import name 'main'
What is the reason (and hopefully the fix) for this?
I didn’t notice that. Thanks for sharing your observation. I have added a comment to the github issue about it.
I find it strange that you did exactly the same as I did and the program works for you… Are you running Leap 42.3? Are you starting the program as normal user (not root)?
Perhaps you misunderstood my question. I was asking if he started the program ‘mpsyt’ as user or root (not the program ‘pip3’). That is not obvious from the screenshot he shared.
And you have some story telling about that you do the same, but that something different happens. Please show that, like malcolmlewis shows it.
Hi
Yes, this system is Leap 42.3, plus in this case it’s in my signature
Installed as root (never use sudo except added with visudo for /usr/bin/build for osc command and building packages), and yes, running the application as my user.
Weird. Might that have anything to do with any security policies (or I don’t know what)? Otherwise I can’t explain why the same software on the same OS doesn’t work the same way.
No. I have another user and testing with it I am getting a similar error:
otheruser@pc:~> mpsyt
Traceback (most recent call last):
File "/usr/bin/mpsyt", line 7, in <module>
from mps_youtube import main
File "/usr/lib/python3.4/site-packages/mps_youtube/__init__.py", line 8, in <module>
init.init()
File "/usr/lib/python3.4/site-packages/mps_youtube/init.py", line 92, in init
pafy.set_api_key(config.API_KEY.get)
AttributeError: 'module' object has no attribute 'set_api_key'
~]: mpsyt
Traceback (most recent call last):
File "/usr/bin/mpsyt", line 7, in <module>
from mps_youtube import main
File "/usr/lib/python3.4/site-packages/mps_youtube/__init__.py", line 8, in <module>
init.init()
File "/usr/lib/python3.4/site-packages/mps_youtube/init.py", line 58, in init
cache.load()
File "/usr/lib/python3.4/site-packages/mps_youtube/cache.py", line 34, in load
pafy.load_cache(cached'pafy'])
AttributeError: 'module' object has no attribute 'load_cache'
Else it is probably some conflict on what you may have previously installed, adjusted your user path at all?
What do you mean?
FWIW this system was installed as openSUSE 13.2, then upgraded each time a new release was out.
Hi
I mean a system path tweak somewhere, change a config etc, install other items with pip3?
If you cat /usr/bin/mpsyt is the first line (the whole shebang);
#!/usr/bin/python3
or
#!/usr/bin/env python3
If you open the python3 interpreter and run (as your user);
python3
Python 3.4.6 (default, Mar 22 2017, 12:26:13) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> import sys
>>> from mps_youtube import main
I can’t recall installing anything else using pip/3 but it is possible.
Here is also the code you asked for:
~]: cat /usr/bin/mpsyt
#!/usr/bin/python3
...
~]: python3
Python 3.4.6 (default, Mar 22 2017, 12:26:13) [GCC] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import re
>>> import sys
>>> from mps_youtube import main
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.4/site-packages/mps_youtube/__init__.py", line 8, in <module>
init.init()
File "/usr/lib/python3.4/site-packages/mps_youtube/init.py", line 58, in init
cache.load()
File "/usr/lib/python3.4/site-packages/mps_youtube/cache.py", line 34, in load
pafy.load_cache(cached'pafy'])
AttributeError: 'module' object has no attribute 'load_cache'
>>>
Hi
Why do you keep upgrading, consider == use the system version? Use the default openSUSE version… pip install must be run as root user, run apps as user…
~]: su -
Password:
# zypper in -f python3-pip python3-Pillow
Loading repository data...
Reading installed packages...
Forcing installation of 'python3-Pillow-2.9.0-4.1.x86_64' from repository '*Main (OSS)'.
Forcing installation of 'python3-pip-7.1.2-7.1.noarch' from repository '*Main (OSS)'.
Resolving package dependencies...
The following 2 packages are going to be reinstalled:
python3-Pillow python3-pip
2 packages to reinstall.
Overall download size: 1.6 MiB. Already cached: 0 B. No additional space will be used or freed after the operation.
Continue? [y/n/...? shows all options] (y): y
Retrieving package python3-pip-7.1.2-7.1.noarch (1/2), 1.1 MiB ( 5.2 MiB unpacked)
Retrieving: python3-pip-7.1.2-7.1.noarch.rpm .........................................................................................................[done]
Retrieving package python3-Pillow-2.9.0-4.1.x86_64 (2/2), 494.1 KiB ( 1.8 MiB unpacked)
Retrieving: python3-Pillow-2.9.0-4.1.x86_64.rpm ......................................................................................................[done]
Checking for file conflicts: .........................................................................................................................[done]
(1/2) Installing: python3-pip-7.1.2-7.1.noarch .......................................................................................................[done]
(2/2) Installing: python3-Pillow-2.9.0-4.1.x86_64 ....................................................................................................[done]
# pip3 install -I mps-youtube youtube-dl
Collecting mps-youtube
Using cached mps_youtube-0.2.7.1-py3-none-any.whl
Collecting youtube-dl
Using cached youtube_dl-2018.1.18-py2.py3-none-any.whl
Collecting pafy!=0.4.0,!=0.4.1,!=0.4.2,>=0.3.82 (from mps-youtube)
Using cached pafy-0.5.3.1.tar.gz
Installing collected packages: pafy, mps-youtube, youtube-dl
Running setup.py install for pafy
Successfully installed mps-youtube-0.2.7.1 pafy-0.5.3.1 youtube-dl-2018.1.18
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
# logout
~]: mpsyt
Traceback (most recent call last):
File "/usr/bin/mpsyt", line 7, in <module>
from mps_youtube import main
File "/usr/lib/python3.4/site-packages/mps_youtube/__init__.py", line 8, in <module>
init.init()
File "/usr/lib/python3.4/site-packages/mps_youtube/init.py", line 58, in init
cache.load()
File "/usr/lib/python3.4/site-packages/mps_youtube/cache.py", line 34, in load
pafy.load_cache(cached'pafy'])
AttributeError: 'module' object has no attribute 'load_cache'
~]: