ERROR: Failed building wheel for scipy
Running setup.py clean for scipy
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-a8ap_657/scipy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-a8ap_657/scipy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' clean --all
cwd: /tmp/pip-install-a8ap_657/scipy
Complete output (9 lines):
`setup.py clean` is not supported, use one of the following instead:
- `git clean -xdf` (cleans all files)
- `git clean -Xdf` (cleans all versioned files, doesn't touch
files that aren't checked into the git repo)
Add `--force` to your command to use it anyway if you must (unsupported).
----------------------------------------
ERROR: Failed cleaning build dir for scipy
Failed to build scipy
Skipping wheel build for seaborn, due to binaries being disabled for it.
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly
should work if youâre ok with the version built by Canonical.
If you want a user install of the most recent version from pypi you can do:
pip3 install seaborn
With no sudo, and no --user
It will take a while to build, however, and you must have the required dependencies. You can probably ensure this with âapt-get build-dep python3-seabornâ, but you must uncomment the source URIs (deb-src lines) in your /etc/apt/sources.list and run apt update first.
Canât figure out why it âcanât build the wheelsâ though.
Now :
>>> import seaborn
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3/dist-packages/seaborn/__init__.py", line 6, in <module>
from .rcmod import *
File "/usr/lib/python3/dist-packages/seaborn/rcmod.py", line 8, in <module>
from . import palettes, _orig_rc_params
File "/usr/lib/python3/dist-packages/seaborn/palettes.py", line 12, in <module>
from .utils import desaturate, set_hls_values, get_color_cycle
File "/usr/lib/python3/dist-packages/seaborn/utils.py", line 8, in <module>
from scipy import stats
File "/usr/lib/python3/dist-packages/scipy/stats/__init__.py", line 348, in <module>
from .stats import *
File "/usr/lib/python3/dist-packages/scipy/stats/stats.py", line 177, in <module>
from . import distributions
File "/usr/lib/python3/dist-packages/scipy/stats/distributions.py", line 13, in <module>
from . import _continuous_distns
File "/usr/lib/python3/dist-packages/scipy/stats/_continuous_distns.py", line 15, in <module>
from scipy._lib._numpy_compat import broadcast_to
File "/usr/lib/python3/dist-packages/scipy/_lib/_numpy_compat.py", line 10, in <module>
from numpy.testing.nosetester import import_nose
ModuleNotFoundError: No module named 'numpy.testing.nosetester'
>>> import numpy
>>> import scipy
>>> scipy.__version__
'0.19.1'
>>> seaborn.__version__
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'seaborn' is not defined
>>> numpy.__version__
'1.18.1'
apparently I have to install a higher version of scipy like this:
When you install from pip, sometimes, if a pre-built version does not exist for your exact platform (like aarch64) it will build binary components from source, in which case it needs to have build dependencies (various language compilers, libraries, headers, etcâŠ). Usually these requirements are listed in the documentation, but you can also use trial an error. For example:
With âpip3 install seabornâ I got an error about a fortran compiler not being installed, so I installed âgfortranâ with apt-get. I reran the build, it went further, this time âpybind11-devâ is missing, so I apt installed that and restarted the pip install again. And so on and so forth. Eventually it builds. This process can be used to build just about anything. In any case it should not be used in combination with sudo.
Please note that on Ubuntu (and Linux_for_Tegra) a --user install is now the default for pip when run as a regular user, so you donât need to use the flag anymore.
The easiest thing to do is usually use apt-get to install the python packages. Most are in Canonicalâs repositories so you can âsudo apt install python-thing (or) python3-thingâ where âthingâ is whatever you would normally pip install.
Sometimes packages are slightly out of date, but often itâs better to develop for slightly older versions of packages since you canât always depend on whoever installs your software to have the latest thing, and requiring it means they have to go through all of the above.
As a test i just did a âpip3 install requestsâ on both my Xavier and Ubuntu box and it showed up in â~/.local/lib/python3.6/site-packagesâ, so Iâm 99% sure. I found it documented on a github issue somwhere but I canât find the reference rn :/
That is odd. Did you upgrade pip at some point from another source (like pip itself)? The user setting can also be overidden by a config file somewhere. Those could possibly be the cause or something else. In any case there is no harm to explicitly specifying --user.
That is probably what did it. The version of pip installed through pypi is not the same as Canonical supplies in their apt repositories. When I do a âwhich pip3â i get â/usr/bin/pip3â and the --version is 9.0.1. Itâs likely yours is somewhere else. You may have other issues with a pip that isnât what the distro supplies, just FYI, however personally Iâve never had an issue upgrading pip in a venv.
Uninstalling it through apt-get wonât be possible since it wasnât installed with apt-get, and reinstalling it wonât fix it if the upgraded pip is in a path that takes precedence, like /usr/local/bin or (i think) ~/bin or ~/.local/bin
Uninstalling it should be the reverse of however you installed it. If you do âwhich pip3â and itâs not /usr/bin/pip3, you can probably just âpip3 uninstall pipâ.
nano@nano-desktop:~$ pip3 uninstall pip
Uninstalling pip-19.3.1:
Would remove:
/usr/local/bin/pip
/usr/local/bin/pip3
/usr/local/bin/pip3.6
/usr/local/lib/python3.6/dist-packages/pip-19.3.1.dist-info/*
/usr/local/lib/python3.6/dist-packages/pip/*
Proceed (y/n)? y
ERROR: Exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/shutil.py", line 550, in move
os.rename(src, real_dst)
PermissionError: [Errno 13] Permission denied: '/usr/local/bin/pip' -> '/tmp/pip-uninstall-f41qhv8t/pip'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/cli/base_command.py", line 153, in _main
status = self.run(options, args)
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/commands/uninstall.py", line 79, in run
auto_confirm=options.yes, verbose=self.verbosity > 0,
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_install.py", line 755, in uninstall
uninstalled_pathset.remove(auto_confirm, verbose)
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_uninstall.py", line 394, in remove
moved.stash(path)
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/req/req_uninstall.py", line 283, in stash
renames(path, new_path)
File "/usr/local/lib/python3.6/dist-packages/pip/_internal/utils/misc.py", line 338, in renames
shutil.move(old, new)
File "/usr/lib/python3.6/shutil.py", line 565, in move
os.unlink(src)
PermissionError: [Errno 13] Permission denied: '/usr/local/bin/pip'
nano@nano-desktop:~$ sudo pip3 uninstall pip
[sudo] password for nano:
nanoSorry, try again.
[sudo] password for nano:
WARNING: The directory '/home/nano/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Uninstalling pip-19.3.1:
Would remove:
/usr/local/bin/pip
/usr/local/bin/pip3
/usr/local/bin/pip3.6
/usr/local/lib/python3.6/dist-packages/pip-19.3.1.dist-info/*
/usr/local/lib/python3.6/dist-packages/pip/*
Proceed (y/n)? y
Successfully uninstalled pip-19.3.1
sudo apt install python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3-pip is already the newest version (9.0.1-2.3~ubuntu1.18.04.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
nano@nano-desktop:~$ python3 get-pip.py pip==19.3
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting pip==19.3
Downloading pip-19.3-py2.py3-none-any.whl (1.4 MB)
|ââââââââââââââââââââââââââââââââ| 1.4 MB 2.0 MB/s
Installing collected packages: pip
Successfully installed pip-19.3
nano@nano-desktop:~$
nano@nano-desktop:~$ which pip3
/home/nano/.local/bin/pip3
If it doesnât, at this point, you can try âsudo apt install --reinstall python3-pipâ to force a reinstall of the default pip. If that still doesnât work, I would suggest a reflash, since itâs likely to be the easiest way to fix the problem.
There are, admittedly confusingly, a second set of instructions for systems with package managers like apt. Please see the relevant link in the post above.
nano@nano-desktop:~$ sudo apt install --reinstall python3-pip
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 1 reinstalled, 0 to remove and 0 not upgraded.
Need to get 114 kB of archives.
After this operation, 0 B of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe arm64 python3-pip all 9.0.1-2.3~ubuntu1.18.04.1 [114 kB]
Fetched 114 kB in 0s (872 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
(Reading database ... 150730 files and directories currently installed.)
Preparing to unpack .../python3-pip_9.0.1-2.3~ubuntu1.18.04.1_all.deb ...
Unpacking python3-pip (9.0.1-2.3~ubuntu1.18.04.1) over (9.0.1-2.3~ubuntu1.18.04.1) ...
Setting up python3-pip (9.0.1-2.3~ubuntu1.18.04.1) ...
Processing triggers for man-db (2.8.3-2ubuntu0.1) ...
nano@nano-desktop:~$ which pip5
nano@nano-desktop:~$ which pip3
/usr/bin/pip3
nano@nano-desktop:~$ pip3
-bash: /home/nano/.local/bin/pip3: No such file or directory
Ok I have to do then:
$/usr/bin/pip3 uninstall pip
Not uninstalling pip at /usr/lib/python3/dist-packages, outside environment /usr
$pip3 --version
pip 9.0.1 from /usr/lib/python3/dist-packages (python 3.6)
by doing so it update the venv accordingly i guess
Thanks
As mentioned, a reflash is probably the ideal way to fix it, since your system is in an undefined state and it might be easier. It looks like pip got installed multiple times in multiple places, and that probably affected a lot of other things. You can try deleting ~/.local/bin/pip3 if it exists, logging out, and logging back in, but there is no guarantee you wonât have other issues.
If you create a venv and activate it, you can probably safely do a pip3 install --upgrade pip from inside the venv and you donât have to do anything else.
Edit: ignore any instructions that were here, theâre not applicable to your setup.
Will install virtualenv itself. Then you can do this to create a venv called âpotatoâ and upgrade pip.
$ python3 -m virtualenv -p python3 potato
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/user/potato/bin/python3
Also creating executable in /home/user/potato/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
$ source potato/bin/activate
(potato) $ pip3 install --upgrade pip
Requirement already up-to-date: pip in ./potato/lib/python3.6/site-packages (20.0.2)
It should be safe to modify anything inside that, however running get-pip.py might still break things. If you need to change the pip version you can do it through pip.