Thank you for your reply. I had followed a tutorial on something that had me setup a virtualenv, but I was confused on how they worked, and how to really use them. I get this idea that there is a directory somewhere for easy one that I create. Is that true? Do you have link to a "noobs" tutorial on these virtualenv?jimmo wrote: ↑Sun Nov 03, 2019 11:47 pmIn general, try to avoid using "sudo pip install" on Linux. The issue is that it can end up conflicting with Python packages installed by your system package manager (e.g. Ubuntu). So for something like esptool, use "apt install esptool".dps wrote: ↑Sun Nov 03, 2019 6:14 pmI did however, figure out my troubles with just using esptool in the first place. im a noob at all of this, so i guess thats why. but i wasnt able to just use "esptool.py" at the terminal. come to find out, to be able to do that i needed to install esptool via "pip3" with sudo, not without sudo. it worked like a charm this time.
Alternatively, you can use a Python virtual environment, which lets you make a kind of sandboxed Python installation with its own set of installed packages.
(In future sessions, you just start with the "source" line).Code: Select all
# Create a directory named venv-esptool python3 -m venv venv-esptool # Enter the venv source venv-esptool/bin/activate # Now anything you do with pip will be confined to this sandbox. You can install packages without sudo etc. pip install esptool esptool --help # Leave the venv deactivate
[SOLVED]Cannot erase flash, ESP32
Re: [SOLVED]Cannot erase flash, ESP32
Re: [SOLVED]Cannot erase flash, ESP32
What's the difference between the two (virtualenv and conda), and do you have a link to a decent guide for someone who has no experience with them?
Re: [SOLVED]Cannot erase flash, ESP32
Oh wait, I think I see how the virtualenv works now, it IS a directory. I should have read that a bit more
Re: [SOLVED]Cannot erase flash, ESP32
Yeah -- "python3 -m venv my-virtual-env" means "run the venv built-in module, to create a directory named my-virtual-env".
This directory will contain a few things
- scripts to set up / manage the venv
- a place to store installed python libraries
"source" is a bash built-in that runs a script in the scope of the current shell. i.e. it's as if you typed those commands in directly. my-virtual-env/bin/activate is a bash script that replaces your $PATH and some other env vars such that:
- "python" (and "pip") is the version of Python that you used to create the venv
- it changes the library path to use the venv instead
- "deactivate" is available in your path.
(note, you may see tutorials saying ". my-virtual-env/bin/activate" -- "." is an alias for "source"
I don't know much about anaconda / conda, but it's basically a more sophisticated version of virtual environments. my understanding is it extends the idea to much more than just Python libraries -- i.e. there are data packages and things. Haven't really looked into it as virtual environments have served me well (and for everything else there's Docker!
- rcolistete
- Posts: 352
- Joined: Thu Dec 31, 2015 3:12 pm
- Location: Brazil
- Contact:
Re: [SOLVED]Cannot erase flash, ESP32
Getting started with Python environments (using Conda)
Conda Managing environments
Why you need Python environments and how to manage them with Conda
Conda Managing environments
Why you need Python environments and how to manage them with Conda
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).
Re: [SOLVED]Cannot erase flash, ESP32
Thank you guys so much! This is an awesome community!