Python 3 Migration

Hi,

I started from How to migrate SiCKRAGE to Python 3 post.
Using Raspberry Pi 3.

I installed Python 3 from this link:


[email protected]:/opt/sickrage $ python -V
Python 3.7.0
Then seems OK.

Could you explain what does
pip3 install -r requirements.txt
do ? I ran it and Python was reset to a v2.x version.

Is it mandatory to switch to DEVELOP branch to perform migration ? in the post it is explained:
Run from SiCKRAGE install folder git reset --hard origin/master if on MASTER branch or git reset --hard origin/develop if on DEVELOP branch

Then kind of confused…

The guide was created to encompass both branches as I will eventually be placing the code onto MASTER branch as well once it becomes stable enough so for now use DEVELOP branch.

The pip3 command installs the required dependencies for the app to function correctly.

I installed Python 3:

/opt/sickrage $ sudo pip3 install -r requirements.txt
Traceback (most recent call last):
File “/usr/bin/pip3”, line 9, in
from pip import main
ImportError: cannot import name ‘main’ from ‘pip’ (/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/init.py)

You may want to try this instead:

python3.7 -m pip install -r requirements.txt

This worked for me on my Ubuntu 18.04.2 system with multiple versions of Python installed.

Good luck.

1 Like

Thanks for your answer. I tried sudo python3.7 -m pip install -r requirements.txt
I have an exception:

Exception:
Traceback (most recent call last):
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/basecommand.py”, line 228, in main
status = self.run(options, args)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/commands/install.py”, line 241, in run
with self._build_session(options) as session:
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/basecommand.py”, line 81, in _build_session
insecure_hosts=options.trusted_hosts,
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/download.py”, line 338, in init
self.headers[“User-Agent”] = user_agent()
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/download.py”, line 101, in user_agent
zip([“name”, “version”, “id”], distro.linux_distribution()),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 120, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 634, in linux_distribution
self.version(),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 688, in version
self.lsb_release_attr(‘release’),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 836, in lsb_release_attr
return self._lsb_release_info.get(attribute, ‘’)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 522, in get
ret = obj.dict[self._fname] = self._f(obj)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 933, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File “/usr/local/opt/python-3.7.0/lib/python3.7/subprocess.py”, line 376, in check_output
**kwargs).stdout
File “/usr/local/opt/python-3.7.0/lib/python3.7/subprocess.py”, line 468, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘(‘lsb_release’, ‘-a’)’ returned non-zero exit status 1.
Traceback (most recent call last):
File “/usr/local/opt/python-3.7.0/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/local/opt/python-3.7.0/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/main.py”, line 19, in
sys.exit(_main())
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/init.py”, line 246, in main
return command.main(cmd_args)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/basecommand.py”, line 264, in main
timeout=min(5, options.timeout)) as session:
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/basecommand.py”, line 81, in _build_session
insecure_hosts=options.trusted_hosts,
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/download.py”, line 338, in init
self.headers[“User-Agent”] = user_agent()
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/download.py”, line 101, in user_agent
zip([“name”, “version”, “id”], distro.linux_distribution()),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 120, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 634, in linux_distribution
self.version(),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 688, in version
self.lsb_release_attr(‘release’),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 836, in lsb_release_attr
return self._lsb_release_info.get(attribute, ‘’)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 522, in get
ret = obj.dict[self._fname] = self._f(obj)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 933, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File “/usr/local/opt/python-3.7.0/lib/python3.7/subprocess.py”, line 376, in check_output
**kwargs).stdout
File “/usr/local/opt/python-3.7.0/lib/python3.7/subprocess.py”, line 468, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘(‘lsb_release’, ‘-a’)’ returned non-zero exit status 1.

Hi echel0n. I really need your help. Currently sickrage is down because of the error I get…

Did you try pip3 install pip then try pip3 install -r requirements.txt

I can take a look at this in 8 hours when I’m off work, to me this looks like an issue with your python or OS install.

Yes I tried. When y perform python3 -V it shows me 3.7.0 then should be OK but it’s complicated to know if everything is very ok on python 3…

Hi,

python3.7 -m pip install -r requirements.txt

this was the command that worked for me as well - as it began installing the necessary packages.
Once it’s done, I will get to the other install steps

[email protected]:/opt/sickrage $ pip3 install pip
Traceback (most recent call last):
File “/usr/bin/pip3”, line 9, in
from pip import main
ImportError: cannot import name ‘main’ from ‘pip’ (/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/init.py)

Are you running that as root ?

No. Should I try login with root and try migration again ?

I would suggest running as root for at the very least the PIP commands.

su
sudo service sickrage stop
cd /opt/sickrage/
git fetch –all
git reset --hard origin/master
image

python3 --version
image

python3 -m pip install -r requirements.txt

Exception:
Traceback (most recent call last):
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/basecommand.py”, line 228, in main
status = self.run(options, args)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/commands/install.py”, line 241, in run
with self._build_session(options) as session:
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/basecommand.py”, line 81, in _build_session
insecure_hosts=options.trusted_hosts,
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/download.py”, line 338, in init
self.headers[“User-Agent”] = user_agent()
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/download.py”, line 101, in user_agent
zip([“name”, “version”, “id”], distro.linux_distribution()),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 120, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 634, in linux_distribution
self.version(),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 688, in version
self.lsb_release_attr(‘release’),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 836, in lsb_release_attr
return self._lsb_release_info.get(attribute, ‘’)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 522, in get
ret = obj.dict[self._fname] = self._f(obj)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 933, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File “/usr/local/opt/python-3.7.0/lib/python3.7/subprocess.py”, line 376, in check_output
**kwargs).stdout
File “/usr/local/opt/python-3.7.0/lib/python3.7/subprocess.py”, line 468, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘(‘lsb_release’, ‘-a’)’ returned non-zero exit status 1.
Traceback (most recent call last):
File “/usr/local/opt/python-3.7.0/lib/python3.7/runpy.py”, line 193, in _run_module_as_main
main”, mod_spec)
File “/usr/local/opt/python-3.7.0/lib/python3.7/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/main.py”, line 19, in
sys.exit(_main())
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/init.py”, line 246, in main
return command.main(cmd_args)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/basecommand.py”, line 264, in main
timeout=min(5, options.timeout)) as session:
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/basecommand.py”, line 81, in _build_session
insecure_hosts=options.trusted_hosts,
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/download.py”, line 338, in init
self.headers[“User-Agent”] = user_agent()
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_internal/download.py”, line 101, in user_agent
zip([“name”, “version”, “id”], distro.linux_distribution()),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 120, in linux_distribution
return _distro.linux_distribution(full_distribution_name)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 634, in linux_distribution
self.version(),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 688, in version
self.lsb_release_attr(‘release’),
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 836, in lsb_release_attr
return self._lsb_release_info.get(attribute, ‘’)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 522, in get
ret = obj.dict[self._fname] = self._f(obj)
File “/usr/local/opt/python-3.7.0/lib/python3.7/site-packages/pip/_vendor/distro.py”, line 933, in _lsb_release_info
stdout = subprocess.check_output(cmd, stderr=devnull)
File “/usr/local/opt/python-3.7.0/lib/python3.7/subprocess.py”, line 376, in check_output
**kwargs).stdout
File “/usr/local/opt/python-3.7.0/lib/python3.7/subprocess.py”, line 468, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command ‘(‘lsb_release’, ‘-a’)’ returned non-zero exit status 1.
[email protected]:/opt/sickrage#

You may have to install the requirements via sudo
Also make sure you’re pip3 is up-to-date with sudo pip3 install -U pip