1.3.11 upgrade to 1.6.1 fails

What is the problem?

1.3.11 upgrade to 1.6.1 fails

Exception:
Traceback (most recent call last):
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 177, in main
status = self.run(options, args)
File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 360, in run
if build_failures:
NameError: global name 'build_failures' is not defined

What did you already try to solve it?

Installed pip, looked at python file lines
/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/base_command.py line 177

        status = self.run(options, args)
        # FIXME: all commands should return an exit status
        # and when it is done, isinstance is not needed anymore
        if isinstance(status, int):
            return status
    except PreviousBuildDirError as exc:
        logger.critical(str(exc))
        logger.debug('Exception information:', exc_info=True)

and

/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 360

               if build_failures:
                    raise InstallationError(
                        "Could not build wheels for {} which use" +
                        " PEP 517 and cannot be installed directly".format(
                            ", ".join(r.name for r in build_failures)))

Have you tried running in safe mode?

Yes

Did running in safe mode solve the problem?

No

Systeminfo Bundle

You can download this in OctoPrint's System Information dialog ... no bundle, no support!)

1.3.11 doesn't have this option, only 1.6.0 and up... :frowning:

Additional information about your setup

OctoPrint version, OctoPi version, printer, firmware, browser, operating system, ... as much data as possible

1.3.11 running on Pi Zero on Prusa i3 MK3

Hi, from the looks of those error, you're still running Python 2.7 which has been EOL for at least a year. Seems also like there might be a problem with the virtual environment that hosts your OctoPrint instance.

To tackle both problems, you might want to upgrade to Python 3 using the following instructions:

Hope this helps solving your situation.

Thanks for the quick reply.

This is how the install starts and it looks like its trying to use python2.

+++++++++++++++++++++++++++++++
Now updating OctoPrint to 1.6.1
+++++++++++++++++++++++++++++++
/home/pi/oprint/bin/python2 -m pip --disable-pip-version-check install 
https://github.com/foosel/OctoPrint/archive/1.6.1.zip --no-cache-dir

**CLI output**
pi@octopi:~ $ python --version
-bash: /usr/bin/python: No such file or directory
pi@octopi:~ $ python3 --version
Python 3.5.3
pi@octopi:~ $ pip --version
pip 20.3.4 from /usr/local/lib/python3.5/dist-packages/pip (python 3.5)

Try this

Thanks but I'm guessing I'll have to reconfig wifi and such?

Not at all, it really is just about setting up octoprint again, not the whole Pi.

ok awesome I'll follow that guide

I got the same error. :frowning:

    Using cached https://files.pythonhosted.org/packages/04/80/cad93b40262f5d09f6de82adbee452fd43cdff60830b56a74c5930f7e277/        wheel-0.37.0-py2.py3-none-any.whl
  Collecting Cython
    Using cached https://files.pythonhosted.org/packages/ec/30/8707699ea6e1c1cbe79c37e91f5b06a6266de24f699a5e19b8c0a63c4b65/        Cython-0.29.24-py2.py3-none-any.whl
  Exception:
  Traceback (most recent call last):
    File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/cli/base_command.py", line 177, in main
      status = self.run(options, args)
    File "/home/pi/oprint/lib/python2.7/site-packages/pip/_internal/commands/install.py", line 360, in run
      if build_failures:
  NameError: global name 'build_failures' is not defined
  You are using pip version 19.0.1, however version 20.3.4 is available.
  You should consider upgrading via the 'pip install --upgrade pip' command.

  ----------------------------------------
Command "/home/pi/oprint/bin/python2 /home/pi/oprint/local/lib/python2.7/site-packages/pip install --ignore-installed --no-u        ser --prefix /tmp/pip-build-env-fEE2N0/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://        pypi.org/simple --extra-index-url https://www.piwheels.org/simple -- setuptools wheel Cython" failed with error code 2 in No        ne
You are using pip version 19.0.1, however version 20.3.4 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

This seems like something inside pip is broken, which is annoying, and difficult to solve. Since you can't reinstall pip, since that would require using pip... Can't install anything because that requires using pip.

Aside from reinstalling OctoPi, the only other thing I can think of is recreating your OctoPrint virtual environment. I would recommend reinstalling OctoPi, since 0.16 is getting old & you will need to move to Python 3 at some point, which is default on new OctoPi versions.

You should be able to create a backup on 1.3.11, and then restore it on 1.6.1 later so you don't lose your settings.

Doesn't apt-get have a reinstall option ? If so, you could use it to return to a known working version of pip, and then try the upgrade again ?

pip isn't installed using apt in this case, since it is in the virtual environment. The python-virtualenv package installed it for you when the virtualenv was created. Even the command python -m ensurepip is disabled on Linux because the installation is managed externally... I will check virtualenv, but I think the only way would be to re-create.

Oh yeah, I had forgot about the virtual environment. But doesn't that copy the systemwide pip when creating the environment ?

No, it doesn't unfortunately. On OctoPi, pip (& the python-pip packages) are not even installed system wide.

Is there a new install guide to follow?

Take a backup & download it using the 'Backup & Restore' tab in the settings, then you can use the standard install guide here:
OctoPrint.org - Download & Setup OctoPrint
Once you have it installed you should be able to restore your backup.

awesome thank you