import torch not defined on gcp - python

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

Related

Getting error while installing pyseer using miniconda

I am a new Miniconda user that needs to use pyseer to perform a GWAS study in regards to a bioinformatic pipeline. After downloading 64-bit Miniconda on Windows 11, I first created a new environment (bioinformatics3) and added the necessary channels according to pyseer documentation:
conda config --add channels defaults
conda config --add channels bioconda
conda config --add channels conda-forge
I want to install pyseer and its dependencies using:
conda install pyseer
However, when I try running this, it always ends up looking something like:
(bioinformatics3) C:\Users\djian>conda install pyseer
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:
I have already tried running this a couple of times and using the commands here as well, but still no luck.
Why is this happening? Any insight/solutions would be amazing and please note that I am a new Conda user with virtually no background in Python/command line since I only am familiar with R.

problem with basemap installation in Conda (MacOs)

I am trying to install basemap in Conda by using the following command
conda install -c anaconda basemap
However I get the following error
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 each other:
Output in format: Requested package -> Available versions
How can I fix it? Because I am trying to plot NETCDF4 files into a map. Basically I am trying to construct a heat map to see the temperatures. Is there any other package I can use in order to do that?
Don't know if this is still needed, but running this:
conda update -all --yes
and then subsequently running:
-c conda-forge basemap
worked for me when I had run into the same problem.

pip install -c dglteam dgl failed

I saw from another thread that current channels could affect it. I would like to install dgl 0.4.3. and pip commands or install from environment files have failed. How can I get it installed? Below is the error log. Many thanks.
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:
dgl
Current channels:
https://conda.anaconda.org/dglteam/osx-arm64
https://conda.anaconda.org/dglteam/noarch
https://conda.anaconda.org/conda-forge/osx-arm64
https://conda.anaconda.org/conda-forge/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.
Here are the platforms the dglteam Conda channel builds for:
Currently, this does not show osx-arm64, which is what the errors indicate OP is on. Instead, either emulate the osx-64 platform with Rosetta 2 or run in a container (e.g., https://hub.docker.com/u/dgllib).

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.

Conda Installation Fails for PySoundFIle

I'm trying to understand why my conda installation of pysoundfile via the following command fails
conda install -n condaenv -c conda-forge pysoundfile
The error message seems to complain about a missing comparability between the required python version and my installed version. But as far as I understand, the version I have in my conda environment is listed and should be supported, right? This is the error message:
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.|
Examining python=3.7: 100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 3/3 [00:00<00:00, 16.26it/s]\failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- pysoundfile=0.10.2 -> python[version='2.7.*|3.5.*|3.6.*|3.6.9|>=2.7,<2.8.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.6,<3.7.0a0|>=3.5,<3.6.0a0|3.4.*',build=0_73_pypy]
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
Your installed CUDA driver is: 11.0
I assume the warning about my cuda driver is a secondary issue that doesn't have anything to do with the pysoundfile installation. Does sombody know what's going on here and how I might bypass the issue?
I was able to replicate this error with conda and python 3.7.
pip install pysoundfile works just fine if you want to install soundfile.

Categories

Resources