I have elementary knowledge on package managers, so forgive me if my question is phrased badly.
I am using miniconda as a package manager. I have python 3.8 installed, and I use jupyter lab to run ipython kernels.
My issue is that when import torch then the version 1.7.1 is loaded to the notebook, however, when I look at conda list I see that version 1.8.1 of torch is installed.
When I try to update using conda update --all and conda update pytorch nothing is being installed.
So
I don't know why pytorch is not updated to the new version of 1.9.
I don't know why an older version 1.7.1 is loaded to my jupyter notebook.
would love to get some help!
I am not sure exactly what solved it, but:
I updated homebrew which required me to install some command line tools of x-code, and then I managed to install pytorch again using
conda install pytorch torchvision -c pytorch.
Now the proper version is loaded when I use jupyter.
Related
I installed the following in an environment:
cudatoolkit=11.3
pytorch=1.11.0
torchvision=0.12.0
But when asking for the torch/cuda version I get this:
$ python3 -c "import torch; print(torch.__version__)"
1.12.1+cu102
Which is not what I want (1.12.1 would be fine, but cu102 is too old). Looking further, I see this:
$ conda list torch
# packages in environment at /home/ml/anaconda3/envs/ldm:
#
# Name Version Build Channel
pytorch 1.11.0 py3.8_cuda11.3_cudnn8.2.0_0 pytorch
pytorch-lightning 1.4.2 pypi_0 pypi
pytorch-mutex 1.0 cuda pytorch
torch 1.12.1 pypi_0 pypi
torch-fidelity 0.3.0 pypi_0 pypi
torchdiffeq 0.2.3 pypi_0 pypi
torchmetrics 0.6.0 pypi_0 pypi
torchvision 0.12.0 py38_cu113 pytorchcode
So "pytorch" has the version I want (with cuda11.3), but "torch" is 1.12.1. Why? Moreover, "torch" does not seem to be a conda package (PackagesNotFoundError when trying to install), which is surprising since it appears in "conda list".
There is clearly something I do not understand about conda / pytorch. Can someone please explain it?
From what I know, the torch package uses the LuaRocks Package manager. And if you use it mostly in python, you should aim for 'PyTorch', which conda only takes care of.
For your case, I strongly suggest you create a new environment and start again installing PyTorch and it's components from the beginning. Read this compatibility matrix and try to install it according to those tables.
So in the end that "torch" fake (?) package was my previous install of pytorch and cuda (with pip). The conda install actually made the pip one not work anymore ("import torch" was not working outside of the environment). Which is even weirder since my understanding of virtual environment was that it should at the very least not affect what's outside.
The solution was to reinstall pytorch with pip (outside the environment). After that, "import torch" worked inside the environment. Which again is weird since conda installed his own version of pytorch, apparently not to use it in the end.
I consider this an "answer" as it solves the problem I was having, but I still don't understand why conda behaved this way.
Got clean installation of Anaconda (Python 3.8.8), tried to install PyTorch by running conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch as suggested by the docs. The thing is, conda tries to install Python 3.9.7 in the process, which does not support Windows 7 (the famous "api-ms-win-core-path-l1-1-0.dll missing error"). Is there a way to make the installation of PyTorch without switching to the latest Python?
If you start with a clean package with a specific python version you could use the --freeze-installed flag to prevent the installer from making any changes to the installed packages, see documentation.
I've installed and imported tensorflow before (https://github.com/ankur715/MOOCs/blob/master/pythonprogramming/ds_tf_keras_tutorial.ipynb), but Anaconda on my Windows went haywire starting this week.
It wasn't loading the Jupyter localhost after several tries/times, so I uninstalled it and reinstalled it. Then realized that Python 3.7 is what didn't allow tensorflow. I downgraded to Python 3.5, checked version of tensorflow which is 0.12.0.
I think it wasn't working because of Python 3.7 earlier, and now tensorflow is 0.12.0. How do I upgrade to tensowflow 1.12.0, to see if that'll solve it?
It is better to remove and install:
conda uninstall tensorflow
conda install -c conda-forge tensorflow=1.12.0
Look here.
I am facing the below error while running the code for LinearClassifier in tensorflow.
AttributeError: module 'tensorflow.python.estimator.estimator_lib' has no attribute 'LinearRegressor'
My current version for tensorflow is 1.2.1. I tried to update the version of the package from ANACONDA environment, its not showing for an upgrade.
I tried to upgrade it from command prompt by using below command, it is successfully updating the package however it is not reflecting to the actual library when I am using it.
pip install --upgrade tensorflow==1.3.0
FYI, I am using Jupyter Notebook and have created a separate environment for tensorflow.
Please let me know if I have missed anything.
If your command pip install --upgrade tensorflowcompiles, then your version of tensorflow should be the newest. However you should restart your notebook. Also, as you said that you are using anaconda. You can also install and upgrade tensorflow as follows:
conda install -c conda-forge tensorflow # to install
conda upgrade -c conda-forge tensorflow # to upgrade
That should work. Check if you are using any environment but you are not updating the tensorflow version within the environment.
Also, please restart the notebook after saving it and run the cells and try. That should work.
Verify in the notebook : run - print(tf.__version__). Please mark the answer if it resolves.
I have downloaded the newest version of scikit-learn (0.18), however, spyder keeps on using the previous version (0.17). How do I make the two compatible?
I have updated both distributions using Anaconda:
conda update spyder
conda update scikit-learn
Edit
Simply forcing Anaconda to install scikit-learn (0.18) did the trick:
conda install scikit-learn=0.18
You may have different versions of sklearn installed (via pip and conda), and spyder using your /usr/bin/python instead of anaconda/bin/python: make sure that the interpreter selected in Spyder preferences is the anaconda one.