Unable to install pillow 6.2.1 in conda - python

After upgrading pytorch / torch-vision the following error occurs:
python -c "import torch ; import torchvision as tv; print(torch.__version__, tv.__version__)
> "
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/pointr/anaconda3/lib/python3.7/site-packages/torchvision/__init__.py", line 4, in <module>
from torchvision import datasets
File "/home/pointr/anaconda3/lib/python3.7/site-packages/torchvision/datasets/__init__.py", line 9, in <module>
from .fakedata import FakeData
File "/home/pointr/anaconda3/lib/python3.7/site-packages/torchvision/datasets/fakedata.py", line 3, in <module>
from .. import transforms
File "/home/pointr/anaconda3/lib/python3.7/site-packages/torchvision/transforms/__init__.py", line 1, in <module>
from .transforms import *
File "/home/pointr/anaconda3/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 17, in <module>
from . import functional as F
File "/home/pointr/anaconda3/lib/python3.7/site-packages/torchvision/transforms/functional.py", line 5, in <module>
from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (/home/pointr/anaconda3/lib/python3.7/site-packages/PIL/__init__.py)
This has been noted as due to an incompatibility between conda and pytorch 7.0.0 https://github.com/pytorch/vision/issues/1712 . So I need to downgrade to pillow 6.2.1:
The command posted to do this is: conda install pillow=6.2.1 -y
However that is failing:
(current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: |
That is hanging. So now what ? The workaround needs itself a workaround .. Is conda broken for torchvision now? The primary reason I am using conda in the first place is torch / torchvision ..
Update Conda tried to resolve conflicts. After 20 minutes of this it was 13% done. Ridiculous. This is a 2020 core i7 mini-tower. No sane program takes more than low double digits seconds to resolve dependencies. I finally killed it. I am going to try the suggestion to do directly from pip:
pip install Pillow==6.2.1
OK - that is hanging .. I am going to uninstall pillow and reinstall it with that version.
Another update #erip has recommended conda install -c conda-forge pillow=6.2.1 - so here we go:
conda install -c conda-forge pillow=6.2.1
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: \
I will let the dust settle on that one but looking quite unlikely.

The only thing that worked for me is to uninstall / reinstall conda
https://docs.anaconda.com/anaconda/install/uninstall/
https://docs.conda.io/en/latest/miniconda.html
And here are the versions conda elected to install:
(base) pointr#alienware:~/anaconda3$ python -c "import cv2; import PIL;print('cv2: ' + cv2.__version__); print('PIL: ' + PIL.__version__)"
cv2: 4.1.0
PIL: 7.1.2
(base) pointr#alienware:~/anaconda3$ python -c "import torch ; import torchvision as tv; print('torch:' + torch.__version__); print('torchvision: ' + tv.__version__)"
torch:1.3.1
torchvision: 0.4.2

Related

No Spyder-Terminal on Spyder 5.0.5 (MacOS)

I tried to install spyder terminal on my spyder.
Steps oI followed (in iPython Console):
!conda install -c conda-forge spyder-terminal
Then:
import spyder_terminal
And I get an error message that says:
No QCoreApplication instance found. Application patches not applied. You have to call load_stylesheet function after instantiation of QApplication to take effect.
Traceback (most recent call last):
File "<ipython-input-2-fb5605fc26a6>", line 1, in <module>
import spyder_terminal
File "/opt/anaconda3/lib/python3.8/site-packages/spyder_terminal/__init__.py", line 10, in <module>
from .terminalplugin import TerminalPlugin as PLUGIN_CLASS
File "/opt/anaconda3/lib/python3.8/site-packages/spyder_terminal/terminalplugin.py", line 17, in <module>
from spyder.api.plugin_registration.decorators import on_plugin_available
ModuleNotFoundError: No module named 'spyder.api.plugin_registration'
I thought that it was because of the enviroment, so I tried to create a new conda enviroment with the spyder terminal module. I do as follows (in my terminal):
conda create -n spyder-env -y
Then:
conda activate spyder-env
And finally:
conda install spyder-kernels spyder-terminal -y
And I get an error that says:
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- spyder-terminal
Current channels:
- https://repo.anaconda.com/pkgs/main/osx-64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-64
- https://repo.anaconda.com/pkgs/r/noarch
To search for alternate channels that may provide the conda package you're
looking for, navigate to
https://anaconda.org
and use the search bar at the top of the page.
Any idea what could I do to get the spyder terminal?
Specs:
Spyder 5.0.5
Anaconda 2.0.4
MacOS Big Sur 11.4
Spyder-terminal hasn't been updated to work with spyder 5.0.5, yet. See here:
No Terminal in Spyder 5 despite installing Spyder-Terminal

import torch not defined on gcp

Trying to run "import torch" on GCP.
I got the message ModuleNotFoundError: No module named 'torch'
Tried to create a new cluster (through the api, not terminal) with the following properties:
dataproc->conda.packages->pytorch==1.7.1,visions==0.7.1
dataproc->pip.packages->tokenizers==0.10.1,datasets==1.5.0
The creation of the cluster timed out and was not created.
the same happened even when tried just
dataproc -> conda.packages -> pytorch==1.7.1
Trying to conda install on the master manually with the following :
conda install -c pytorch pytorch
After more almost an hour, I got :
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment -/
Thanks for any help or advice
i.e., except torch I also need :
from transformers import LongformerModel, LongformerTokenizer
from model import RedditModel
You just need to use a newer/latest PyTorch version available in conda-forge channel (1.8.0 now):
gcloud dataproc clusters create ${CLUSTER_NAME} \
--image-version=2.0 \
--region=${REGION} \
--properties='^#^dataproc:conda.packages=pytorch==1.8.0,torchvision==0.9.0'
Instead of using conda install, try with conda forge. That should work.
https://anaconda.org/conda-forge/pytorch

Anaconda failing to solve environment

** Disclaimer: I am relatively new to data science and anaconda. I have basic competency in python however, I'm no expert (took an accelerated course on the path to obtaining an applied economics major if that helps illustrate where I'm at)**
Basic Info: MacOSx (Catalina v 10.15.4), Anaconda Navigator v 1.9.12, Spyder v.4.0.1
I am still unable to install selenium on anaconda even after trying all of the following commands in my terminal:
conda install -c conda-forge selenium
conda install -c conda-forge/label/gcc7 selenium
conda install -c conda-forge/label/cf201901 selenium
conda install -c conda-forge/label/cf202003 selenium
Each time I try, I get this message
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \ Found conflicts! Looking for incompatible packages.
Found conflicts! Looking for incompatible packages. This can take several minutes.
Press CTRL-C to abort.
Examining conflict for notebook anaconda jupyter_client libsodium zeromq spyder pyzmq spyder-kernels: : 325it [45:34, 1.0
Examining conflict for notebook anaconda jupyter_client libsodium zeromq spyder pyzmq spyder-kernels: : 326it [45:34, 1.4
Examining conflict for anaconda lxml: : 326it [45:37, 1.49s/it] failed |
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
...
...
After this it lists a BUNCH of stuff that all look similar to this (this is just the first line of MANY):
anaconda-navigator -> python[version='2.7.*|3.5.*|3.6.*|3.4.*']
...
...
Things I have tried to resolve this problem:
conda update conda because I heard this might have something to do with having a python v that wasn't compatible with anaconda navigator. Update was successful but came back with the same message above
pip install -U selenium and python setup.py install
Please help me be able to use selenium in spyder!!! Thank you so much!

Cannot install ggplot with conda-forge

I am trying to install ggplot with conda-forge. But it is showing some certain error. Details error message is given below.
(base) C:\Users\ASUS>conda install -c conda-forge ggplot=0.11.5
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: -
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- ggplot=0.11.5 -> python[version='2.7.*|3.5.*|3.6.*|3.4.*']
Your python: python=3.7
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
The following specifications were found to be incompatible with your CUDA driver:
- feature:/win-64::__cuda==11.0=0
- feature:|#/win-64::__cuda==11.0=0
Your installed CUDA driver is: 11.0
Please help me with any solution.
I have found an alternative of ggplot, which contains all ggplot function. It's plotnine.
To install plotnine
# Using pip
$ pip install plotnine # 1. should be sufficient for most
$ pip install 'plotnine[all]' # 2. includes extra/optional packages
# Or using conda
$ conda install -c conda-forge plotnine
For usage guideline please visit https://plotnine.readthedocs.io/en/stable/index.html
The development of yhat's ggplot python port stopped in 2016. It seems that it is only compatible with pandas<0.22 which predates python 3.7 and is thus not available for python-3.7 on conda-forge.
The easiest way to use it is to install it into an environment with a python3.6 interpreter.

Unable to import scipy after installing Anaconda2.4.0

I'm trying to import numpy and scipy in Python 2.7.10 on Windows
I've been unable to install scipy via pip or the binaries supplied at:
http://www.lfd.uci.edu/~gohlke/pythonlibs/#scipy
But I had heard that Anaconda comes standard with numpy and scipy. It's worth noting I can successfully import numpy.
conda list
prints out all packages and scipy is one of them but the import still fails.
When I run
$ conda install scipy
This is what I see:
$ conda install scipy
Fetching package metadata: ....
Solving package specifications: ..................
Package plan for installation in environment c:\Users\Nick\Anaconda2:
The following NEW packages will be INSTALLED:
conda-env: 2.4.4-py27_1
Proceed ([y]/n)? y
Linking packages ...
"Ensuring that c:\Users\Nick\Anaconda2\Library\bin is on user PATH environment variable."
"" was unexpected at this time.
Error: Error: post-link failed for: conda-env-2.4.4-py27_1
When I run
$ conda install -f scipy
This is what I see:
$ conda install -f scipy
Fetching package metadata: ....
Solving package specifications: ..................
Package plan for installation in environment c:\Users\Nick\Anaconda2:
The following packages will be UPDATED:
scipy: 0.16.0-np110py27_0 --> 0.16.0-np110py27_0
Proceed ([y]/n)? y
[ COMPLETE ]|##################################################| 100%
Extracting packages ...
[ COMPLETE ]|##################################################| 100%
Unlinking packages ...
[ COMPLETE ]|##################################################| 100%
Linking packages ...
[ COMPLETE ]|##################################################| 100%
It appears to be working but when I then try to import scipy at the top of my Python program, I get:
$ python steps.py
Traceback (most recent call last):
File "steps.py", line 16, in <module>
import scipy as st
ImportError: No module named scipy
Am I doing the import wrong?
From my research, especially of github.com/conda/conda/issues/1786 I believe Anaconda 2.4.0 fails for scipy. The solution is to get a newer version of Anaconda or consider installing the latest Miniconda.

Categories

Resources