Installation of an Environment (Windows)

So, I’m trying to run a fairly simple code, but I am continually running into errors. This is the code I’m having trouble with:

conda create -n get3d python=3.8
conda activate get3d
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install ninja xatlas gdown
pip install git+https://github.com/NVlabs/nvdiffrast/
pip install meshzoo ipdb imageio gputil h5py point-cloud-utils imageio imageio-ffmpeg==0.4.4 pyspng==0.1.0
pip install urllib3
pip install scipy
pip install click
pip install tqdm
pip install opencv-python==4.5.4.58

When I go to open the prompt, I get this message (Not I emitted my username and replaced it with Username) “Unable to create process using 'C:\Users\Username\anaconda3\python.exe “C:\Users\Username\anaconda3\Scripts\conda-script.py” shell.cmd.exe activate “C:\Users\Username\anaconda3” '”. This appears on every launch of the prompt. I have tried both miniconda and anaconda and ran into the issue both times. Following this error “conda” isn’t recognized, preventing the environment from forming. I also receive this error when using the powershell form:

Unable to create process using 'C:\Users\Username\anaconda3\python.exe "C:\Users\Username\anaconda3\Scripts\conda-script.py" shell.powershell activate "C:\Users\Username\anaconda3"'
Invoke-Expression : Cannot bind argument to parameter 'Command' because it is an empty string.
At C:\Users\JR Cross\anaconda3\shell\condabin\Conda.psm1:76 char:36
+         Invoke-Expression -Command $activateCommand;
+                                    ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Invoke-Expression], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorEmptyStringNotAllowed,Microsoft.PowerShell.Commands.Invo
   keExpressionCommand

In addition to this, earlier, I was able to run the software up to here:

conda create -n get3d python=3.8
conda activate get3d
pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html
pip install ninja xatlas gdown
pip install git+https://github.com/NVlabs/nvdiffrast/
pip install meshzoo ipdb imageio gputil h5py point-cloud-utils imageio imageio-ffmpeg==0.4.4 pyspng==0.1.0

But it was cut off by psypng, requiring me to download the c++ build tools; which I did. Following that, the miniconda software I was using at the time started giving me two error messages being “Failed building wheel for pyspng” and then “Could not build wheels for psypng, which is required to install pyproject.toml-based projects.” I tried to debug it for a while, but eventually gave up and reinstalled the software. After that, it fully stopped working and I was unable to get anywhere besides reinstalling, restarting, changing the PATH, and trying my best to figure out what I could. I know this is quite lengthy, but if anyone has any suggestions I would greatly appreciate that. Also, if any more information is needed, I’d be happy to provide. Thanks again :slight_smile:

Oh, I should also add that I’ve downloaded Git and Python as well. Though my Python is the latest version (not sure if that makes any difference but thought I’d still add it).

I found a work around for anyone wondering. I just used virtualenv instead and it worked like a charm.

You’re mixing a ton of different things here that are going to make things very complicated.

First, Anaconda (and miniConda) use the conda package manager, not PIP. It’s generally a good idea to use only a single package manager to, umm, manage packages. So in your case, all the packages originally installed with Anaconda were installed through conda, and all the additional packages were installed with pip. This often leads to inconsistencies and incompatibilities.

2nd you are mixing environments as well. Anaconda/conda environments are different than virtualenv environments. For one thing conda environments are a container above python, so different conda environments can have different python versions and even other applications, whereas virtualenvs exist within python and apply solely to python packages and configurations.

Either pip/virtualenvs or conda/conda environments can work fine, but it’s best not to mix them, pick one set and stick to it. If you then must use pip to install a package (because it’s not available in a conda repo, for example), do it very carefully and in a dedicated environment.

Thank you for this very useful info. So in summary, it can get very tricky to mix package managers. But, the provided thing I sent (see below) requests both. Does that mean it isn’t possible? Or do you think that it may be possible to use PIP and exchange Conda for Virtualenv while using the 3.8 Python that is already on my system? Thank you sincerely for your time. I’ve had a very tricky time getting help as I can’t find much information on this topic so I’ve been searching all around to no luck. Do you have any suggestions for places to look or resources to use? Thanks again :).
conda create -n get3d python=3.8

conda activate get3d

pip install torch==1.9.0+cu111 torchvision==0.10.0+cu111 torchaudio==0.9.0 -f https://download.pytorch.org/whl/torch_stable.html

pip install ninja xatlas gdown

pip install git+https://github.com/NVlabs/nvdiffrast/

pip install meshzoo ipdb imageio gputil h5py point-cloud-utils imageio imageio-ffmpeg==0.4.4 pyspng==0.1.0

pip install urllib3

pip install scipy

pip install click

pip install tqdm

pip install opencv-python==4.5.4.58

In my experience there is, unfortunately, a lot of very bad python advice on the internet, especially around installing packages. Recommendations to install things with no regard to the package manager used previously, etc, is rampant. Honestly, if you are working with newer and advanced packages, package management is one of the hardest things to deal with.

You’d probably be fine using a conda environment with pip installed packages, as long as all your packages were installed through pip. You’d want to remove any default conda installed packages first, then install everything you need with pip. Or you could use a venv within a conda environment, with the same caveat. The main issue is that the package managers don’t share their list of what’s installed and the associated dependencies. There are some "beta"ish methods of trying to get conda to work with pip (see link ), but your mileage may vary.

When presented with these challenges in the past, I’ve generally done the following:

  1. Check if the package is included in the standard conda repository (conda search <package>) . If yes, install from there. (make sure to check the version number as well, if that’s important)
  2. Check if the package is available in the conda forge repository (conda search -c conda-forge ). conda-forge is much large than the standard repository, but is more open and less reliable. If available, then install from there.
  3. Google to see if the package is available in another repository. Searching “conda ” is a good start. For example, there is a pytorch repository that is probably the best source for pytorch related modules.
  4. If the package is only available via pip, then a) create a new environment so you don’t end up hosing your currently good one, b) enable the conda pip interop option as listed in the link above, and c) install your packages into the new environment via pip one at a time and pray to your favored deity as you do so!

I just discovered there’s also a dedicated pytorch respository, so conda search -c pytorch may find it even if it’s not in the standard repository or in conda-forge.

of the packages you’ve listed above:

  • torch - this is an odd one. I believe the Conda version of the pip “torch” package is “pytorch”. Not sure why they named them differently. There is some differences between “torch” and “pytorch”, but I’m not sure the pip package is actually “torch” and not really just “pytorch”. I’d recommending researching this more.
  • torchvision - in conda, but the oldest version is 0.11.3. there are older versions in pytorch (repository)
    torchaudio - in the pytorch conda repository
    ninja - in standard repository
    xatlas - ugh, this one’s a mess. It’s in conda repositories, but I could only find linux and OS X binaries. if you need Windows, you may have to use pip for now.
    gdown - in conda-forge
    git+https link - this is complicated, as conda doesn’t work this way. I’m going to have to defer this to an expert. Or maybe ask this as a separate question? “How can I install a package directly from github like “pip install git+https://github.com/” using conda?”

You can look the rest up similarly. I bet most of them will be either in the default repo or in conda-forge.