Conda Create Environment Error: InternalArchiveError - python

first time posting on stackoverflow.
So I guess to summarize my problem I should say that I want to do some work with Python's statsmodels. However statsmodels only supports up to Python 3.8 and I am using 3.9. So I need to create a new conda environment. After that I will need to set it up in Spyder.
Um..I am using Windows 10. I also have Python 3.9 installed separately.
I have a few questions to go with this if that is okay.
With Anaconda installed, do I need to install Python? Would that be redundant?
Would having installed Python separately cause issues with conda or with Spyder?
Do I need to reinstall Anaconda?
Do I need to uninstall Python?
After having solved this problem with your help, can the method used to solve this problem (InternalArchiveError) be generalized so if I encounter it again I know what to do?
I have tried the command:
conda clean -a
which did not work and I found from here: InvalidArchiveError when executing conda install notebook
This post addresses InvalidArchiveError for a different problem and the solution worked for someone using Ubuntu. I was hoping for the best in trying it for my setup.
When I do that however I am getting an internal archive error:
The project name is enph_proj, to denote a space where I will do a small time series analysis on a stock with ticker enph
Here is a picture of my 'conda info'. I hope it is helpful
conda info
Thank you all!

Related

Spyder not opening in Anaconda - "Cannot import name from partially idealised module (most likely circular import)" Possible duplicate files?

first time poster
I am using the Climada modelling tool with Spyder as my IDE of choice through Anaconda. I have created a new environment as per the Climada installation instructions and need to open Spyder to complete the final stages of the installation by running tests. Anyway...onto the problem.
I uninstalled Anaconda earlier, and then did a reinstall. Unfortunately after the reinstall Spyder was not opening in the Navigator, so I tried it through the prompt instead, and received the following message:
Terminal message (apologies, reputation is not high enough to display image)
I think it could be duplicate files leftover in my "AppData\Roaming" folders from my earlier uninstallation of Anaconda that is causing a few issues, but I'm not 100% sure.
Would anyone be able to confirm the problem/provide some help as to what I need to do to overcome this issue? At the moment I'm reluctant to delete any files that may need to be kept
Thanks in advance!
The conda environment for CLIMADA is known to create some issues with Spyder, although I am not sure what the exact problem with your particular issue is.
I can recommend a few things to try (also explained in the docs here):
First step, deinstall spyder in the environment and then:
Install spyder in the conda environment using pip instead of conda
conda activate climada_env
pip install spyder
Install spyder 4 instead of 5
Install spyder in a separate conda environment and configure it to use the climada_env (similarly as recommend by Daniel Althviz).

After installing dotmap in an environement I still get ImportError: No module named dotmap when trying to run the notebook

Today I come with a two in one set of issues that's on the verge of making me smash my computer to pieces! So please I would greatly appreciate any help as I've been stuck on it for two days now.
I have a project where osmnx is required, so I follow the install instructions provided. Which means that I created a dedicated (clean) environment for it. Within this project there is a notebook that I should run, which leads me to ImportError: No module named dotmap. So I say okay, and install dotmap in the environment through conda install.
Now heres the situation, even though I installed it sucessfully in the environment, I keep getting the same error when I run the notebook! So I think maybe I should reinstall dotmap using pip through conda prompt. But when I use pip install in the dedicated ox environment, I get failed to create process. So I say okay, lets install it again through conda install but it still doesn't work.
I see that the dotmap is being called from a main.py document. So I decide to check the main.py document by installing spyder through anaconda navigtor. Once it's installed I click launch and spyder never launches! I try to launch from the conda prompt and I just get Unable to create process using 'C:\Users\THESIS\.conda\envs\ox2\python.exe C:\Users\THESIS\.conda\envs\ox2\Scripts\spyder-script.py.
At the moment I ran out of ideas of what to do as I tried to work around it numerous times. Before questions get asked (and I hope someone asks something), I'd like to say that I already:
Reinstalled anaconda navigator
Tried created numerous environments in various different ways of installing osmnx and dotmap
Tried reinstalling and launching spyder in numerous different ways (Same thing is happening with Jupyterlab)
And probably some other things that I can not remember now off the top of my head
I know I sound fed up and angry at the moment but I just can not understand how I did not find a solution to this (what should be) simple issue.
All in all, any help is greatly appreciated!!
Following droptop recommendation, I actually just did a full clean (another one) reinstall of anaconda where I deleted almost everything that I could.
I installed it again and it's working now! Thanks for the help anyway!!
Your fresh anaconda install should have jupyter, jupyterlab and spyder in the base environment. Starting the anaconda prompt and typing in jupyter notebook should launch jupyter.
Try activating your ox2 environment with another prompt, and follow through from step 3 of this post https://medium.com/#nrk25693/how-to-add-your-conda-environment-to-your-jupyter-notebook-in-just-4-steps-abeab8b8d084

Python packages not working in either python 3 or python 3.7.2. files

As someone who just got into data science (no prior coding history) I am new to using terminals, Python, and coding in general. While I do have some basic Python knowledge now, and I want to work on my first machine learning project, I am looking to use some packages that are not standard to python or jupyter lab, namely: TensorFlow.
After much struggle I was able to download TensorFlow in my terminal (i'm on Mac). Yet when I try to import to module I come to the following problem:
when I create a new file in jupyterlab (accessed via Anaconda) I have the option to create a python file using python 3 or python 3.7.2. When using python 3, I have access to packages to sklearn, SciPy, yet no TensorFlow. Then when I create a 3.7.2. file I can import the TensorFlow package, yet I cannot import the sklearn and SciPy packages anymore....
Did someone experience similar problems? Are there ways to solve this?
P.s. Using the 'pip install ...' command in terminal only sees to work rarely. Or I must be something wrong.
Thanks in advance,
John
If you willing to use condam then the easiest way is to install this package with conda:
conda install packagename
You may search what there is available before installing:
conda search packagename
Otherwise, if you still want to use conda with pip, checkout Using Pip to install packages to Anaconda Environment
I know what you are going through as even I went through a similar problem when I started. It seems that there are two different environments. One with Python3 and one with Python 3.7.2. The problem is arising because the modules are installed in different environments. Your TensorFlow module in Python 3.7.2 environment and sklearn modules in another environment.
It will better if you install all your modules in the base environment for ease in use.
I hope this helps.

How can I fix this pytorch error on Windows? (ModuleNotFoundError: No module named 'torch')

Edit: You might want to skip to the end of the question first, I've followed some advice in comments / answers and the current error is different from the original (appears to be related to numpy possibly).
This error ModuleNotFoundError: No module named 'torch' shows up in tons of threads, I've been trying solutions all day. I'll go through my troubleshooting steps one by one, using the solutions suggested in threads.
System info:
Windows 10
First thing I did was follow the instructions on Pytorch, installed Anaconda and did this using the correct settings for my machine (Note: I tried Python v3.7 before trying v3.8 in these screenshots, none of the solutions worked with that either):
As you can see, that should be good to go, according to the instructions.
So I go into the python terminal and try to import pytorch, like so:
ModuleNotFoundError: No module named 'torch' Great, so what now? Well I paste the error into Google and begin my 4 hour wild goose chase.
First result, stack overflow answer: No module named "Torch"
Let's try the selected answer, it requires some version-related syntax so lets check my python version:
Alright so as directed by the answer:
Try to install PyTorch using pip:
First create a conda environment using:
conda create -n env_pytorch python=3.6
Ok:
Activate the environment using:
source activate env_pytorch
That doesnt work, but if we activate using the instructions given by the prompt, we can do so:
Now install PyTorch using pip:
pip install torchvision --user ( this will install both torch and torchvision)
Hmmm.. well that went up in flames, so the following...
Now go to python shell and import using the command:
import torch
import torchvision
...doesn't do anything new, same error as before.
Well, to the next thread, on PyTorch GitHub: https://github.com/pytorch/pytorch/issues/4827
They're trying to use Jupyter, so I tried this, is was another long process like the above that went up in flames, and I really dont want to need to use Jupyter anyway, so we'll skip this one.
Another Pytorch GitHub thread: https://github.com/pytorch/pytorch/issues/12004
#edtky Could you please give me the output of the following commands
in CMD?
where conda.exe
where pip.exe
where python.exe
Sure I'll give it a shot:
#edtky Looks like you have two Python environments. Please try
importing torch in Anaconda Prompt.
Oh well, I already did that. No bueno.
Another thread: https://discuss.pytorch.org/t/modulenotfounderror-no-module-named-torch/7309 suggests:
In that case you’ve probably forgotten to activate the environment
where pytorch is installed. It can also be the library missing in your
PYTHONPATH variable.
Well I did activate the environment as shown above, but I dont know anything about a PYTHONPTH variable, seems like the PyTorch setup guide wouldve mentioned if I needed to manually do that, I have no clue how to do it and you aren't explaining, so lets look for other answers.
Someone made a whole article to give us this little gym of advice: https://medium.com/#valeryyakovlev/anaconda-no-module-named-torch-ead10946de66
Another beginner error I encountered when started to use pytorch in
anaconda environment
import torch ModuleNotFoundError: No module named ‘torch’ the proper way to install pytorch to anaconda is following
conda install -c pytorch pytorch It’s not enough to simply run “conda install pytorch” — the package won’t be found. So first
activate your conda profile with “source activate {your_profile}” and
then run the command conda install -c...
Ok thats new info, let's try that command again now that our env is activated:
Ok that's a lot of green, let's try now...
Well we can't win 'em all, so lets go onto the next thread: https://forums.fast.ai/t/modulenotfounderror-no-module-named-torch-windows-10/12438/2
I had also faced the similar problem , I just installed torch and torchvision using pip and it worked …
Ok! Let's try:
Oh well, another solution up in flames..
I ran into a similar issue with Windows 10. In the end I could only get torch installed with Miniconda.
Alrighty, lets try it!
Alright, cool, moment of truth:
Awesome! You just read through 25 minutes of me re-producing all my attempts to solve this problem, and it doesnt even include the hour I spend down a rabbit hole trying to use Jupyter, which failed equally as miserably. I think it's time to post the question to StackOverflow!
Edit 1:
An answer points out that one of my logs was an error python 3.8 isn't compatible with pytorch, good point I'll fix that. After unintalling 3.8 and installing 3.7:
And no luck! Remember I actually mentioned in my first paragraph that while I was trying 3.8 in these screenshots, the first time around I did all of this with 3.7
Edit 2:
I forgot to install after activating the environment in the previous edit. Once I fixed that, there's a new error:
Pytorch requires 3.5 <= python < 3.8. Setup an environment with:
conda create -n pytorch python=3.7
conda activate pytorch
conda install pytorch
You should also make sure that you launch the installed python interpreter from this environment (YourAnacondaInstallDirectory\envs\pytorch\python.exe) from the activated conda environment! The later is important because conda will export certain environment variables (have a look at this for a related issue caused by missing envionment variables).
Use This Let me Know if it will Work!
pip install https://download.pytorch.org/whl/cpu/torch-1.0.1-cp37-cp37m-win_amd64.whl
If you would like to install it with plain pip rather than conda:
As you know, Pytorch 1.5.1 requires 3.5 <= python < 3.8. Use Python 3.7 or slightly earlier.
Do NOT try to install with simple pip install torch. Instead, as you say, go to https://pytorch.org/, in the colorful grid, click on pip, copy the command, open a command prompt as an administrator (right-click and select "Run as Administrator") then paste the command, which should look something like:
pip install torch===1.5.1 torchvision===0.6.1 -f https://download.pytorch.org/whl/torch_stable.html
Then, edit the command to replace pip with the full path to your version of pip, e.g.:
"C:\Program Files\Python37\Scripts\pip.exe" pip install torch===1.5.1 torchvision===0.6.1 -f https://download.pytorch.org/whl/torch_stable.html
(You don't need to edit the command as long as Python 3.7 is in your path.)

conda update crashes python

I'm trying to update/upgrade my Python with conda. I run the command:
conda update conda
but it crashes my Python:
Python has stopped working
A problem caused the program to stop working correctly. Windows will close the program and notify you if a solution is available.
My installation information is:
conda version : 4.5.2
conda-build version : 3.0.27
python version : 3.6.3.final.0
I googled the issue and got this github issue report. Unfortunately none of the solutions worked for me. I would appreciate if you could help me know what is the problem and how I can solve it.
I tried uninstalling and reinstalling conda and the problem disappeared temporarily. But then the issue happened again while I was trying to use matplotlib.
I experienced the exact same issue one a different machine when running conda update --all so either there is something wrong with conda or I'm making one mistake twice! (conda/python versions were exactly the same as above.)
I tried updating/upgrading all of the packages running the command in this post on admin-cmd. It took a long time to finish and the problem was still there.
There seemed to be issues with Qt. So I tried to uninstall and reinstall Qt and pyqt but it did not solve the problem either.
temporary workaround: I completely uninstalled Anaconda and installed stock Python. So far this has solved the problem both on my home and work computers.
Try conda update --all or if you're trying to update / upgrade specifically python then try conda update python. Faced such problem and it worked for me.
As was suggested by the mods, here I post my temporary solution. Considering that none of the other attempts (reinstalling Qt, Anaconda, updating with pip...) worked, I ended up uninstalling Anaconda and everything pythony and installed the stock / vanilla python from the official website. This has solved the issue so far. Please consider this is not a solution to the problem mentioned above but just to get the python working for the time being.

Categories

Resources