Environment variable 'USER' is not defined


Hello,I use pip install NuPIC and NuPIC.core successfully, but when i try to run the examples in NuPIC source code, then i always get a problem as follows:
" variable %r, which is not defined" % (varname))
RuntimeError: Attempting to use the value of the environment variable ‘USER’, which is not defined
who can tell me what should i do? thank you!

Help with a basic python error

You should research how to set an environment variable on your OS and set ‘USER’ to the your username you use to log into the OS.


Thank you! i tried that, but it does not help, and i wander if it is the problem about that when i use the install command without using --user


I solved the problem, thank you very much @rhyolight


How did you solve the problem?


I did that follow rhyolight tells me that set ‘USER’ to the your username you use to log into the OS.
it does not work as i didn’t restart my computer after i set the environment variable 'USER’
so,after i restart my computer, i solved this problem.
thanks rhyolight again.


In case useful for anyone else…

Im running nupic in a pipenv and so ran into this problem too.

I managed to work around it by setting the USER variable in a .env file in same folder as my Pipfile