Fallowing the freecodecamp's django tutorial I'm stack on the very beginning - I can't set up virtualenv. Everything goes great until it's time to make final step - activate virtualenv and download Django.
I'm working on Windows 10, and tried a lot of ways to solve it. Everything ends up with to results, but first things first. Here is what i did:
Ran powershell as administrator and set up ExecutionsPolicy as unrestricted
Create new folder called 'Dev'
Inside Dev created another folder for project with virtualenv - everything by command 'virtualenv name of the folder
Tried to activate it by "name_of_project's_folder\Scripts\activate"
After this I'm getting error which says that I must "source this script". I tried to make path to the Scripts folder and type only activate but it doesn't work. When I tried to type "name_of_project's_folder\Scripts\activate" but with ".bat" added on the end, nothing happens. Like, literally nothing.
I really hope for making this work because I'm slowly getting frustrated coz of tons of research I made today nad a lot of blind tries to solve this. Python was downloaded via powershell and pip if it's important.
What about project_folder\Scripts\activate.ps1? Or you can just use cmd instead of powershell.
Related
TL;DR - Microsoft Store Apps are broken (0 bytes), hence the Python interpreter is unable to create process and run "Python" inside virtualenv, I failed to follow numerous explanations of how to change virtualenv path for Python.
Recently, without any changes to my computer/environment, an issue started occurring when executing (also tried python3, which brings the same):
python manage.py runserver
This brought back the following issue:
Unable to create process using
'"C:\Users\MyUser\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe"'
As I dug deeper, I realized that all of the apps installed under this folder are 0 bytes, hence they are completed broken, all of a sudden.
Therefore I figured it's not an issue with Django, rather the python itself.
I tried changing the virtualenv path for Python.exe, instead of using WindowsApps version, I installed the original Python from the original website.
I failed to do so, multiple times.
I tried: "https://stackoverflow.com/questions/4757178/how-do-you-set-your-pythonpath-in-an-already-created-virtualenv/47184788#47184788" - Adding the path inside "activate" and "activate.bat", as
set PYTHONPATH="C:\Users\MyUser\AppData\Local\Programs\Python\Python310\python.exe"
And the issue persists.
I tried every solution/article I found in regards to the issue I have. Many of them claim a simple result, whereas the rest claim a complete refactor is required.
Even downloading from Microsoft store is broken, it always fails.
Since I'm unable to remove the broken apps, and I wasn't able to find a way to change the virtualenv Python interpreter, I am here, asking for your assistance.
Thanks in advance,
Since you have installed python from python.org, ensure that it has been properly added to the PATH and you're not inadvertently using the windows store version.
Open command prompt
Execute where python to check which python your system is using.
If you're only seeing the WindowsApps version of python listed in the output of where command, then python installer apparently didn't add the location to PATH, so you'll need to manually add it yourself.
Also, if you're not restricted to use virtualenv, you can give conda a try.
As I began rebuilding, I figured it out.
When building a virtualenv, the python I used was directing to:
"C:\Users\MyUser\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\python.exe"'
Python interpreter is saved as the "PATH" to execute python.
Since my Python interpreter from Microsoft Store went broke, I was unable to execute python inside the virtual environment.
Venv configures a file called:
pyvenv.cfg
This is how the virtual environment knows what Python interpreter to use.
Inside it, the first line states:
home = C:\Users\MyUser\AppData\Local\Microsoft\WindowsApps\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\
Therefore, we just need to re-configure it to the new path of Python interpreter:
home = C:\Users\MyUser\AppData\Local\Programs\Python\Python310
And it worked for me.
Thanks for everyone's assistant, glad it's done.
I am having a hard time activating virtual environment, after I have created it.
The thing is, that when I try to activate virtual environment in command line, it works -
virtualenvironmentname\Scripts\activate
But when I try to run the same command in Atom, (I am using the Terminus package in order to be able to run the terminal inside Atom) I get this message -
File (path\activate.ps1) cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies
at https:/go.microsoft.com/fwlink/?LinkID=135170.
I was trying to run it by using slightly different commands such as -
activate virtualenvironmentname or activate (virtualenvironmentname)
, but it did not work.
I was further investigating a little more and I have found some clues, that I might need to change some script execution policies, but I am little bit afraid to do so, because I do not want to mess up my computer since I am just a beginner when it comes to system configuration.
Could anybody please tell me, how could I fix this problem? It would be really convenient for me to be able to run the virtual environment from Atom, since I will be writing my Python and Django lines of code there.
Thank You very much and I hope, that my description of the problem was somehow understandable.
I installed Anaconda using defaults.(i'd post a .png of button i pushed but i don't have the rep for more than two links)
I am following the test drive for Anaconda Test Drive and had a problem with Section #2 - Environments.
Following the provided code I created several environments, switched between them, and then deactivated one.
When i deactivated the environment I went to place where 'conda' is not longer a recognized command.
Anaconda Terminal Session:
i open anaconda terminal and begin in the root directory.
i successfully activate the environment 'snowflakes'.
i issue command 'deactivate' which should return me to root directory.
however, i am now farther up the file structure where 'conda' is not a recognized command. i suppose i can issue 'cd appdata\local\continuum\anaconda2' to solve the problem but i'm thinking i've probably messed something up and would like to fix the problem.
any suggestions what to do?
some things i encountered before posting question:
1. when i installed anaconda there was a checkbox that had something to do with PATH - but anaconda encouraged me NOT to check the box - so i did not.
2. I have also read some posts here discussing that one should have a simple path so I wonder if I should install this someplace other than the default path - which is kinda long as you can see in the terminal session.
any help would be appreciated.
I think I know why the command conda is not being recognized.
When you typed the first time (in your screenshot of the terminal) you were at C:\Users\RAdams.GNSMEM\AppData\Local\Continuum\Anaconda2. Inside this folder you should have the executable conda, so when you called it inside this folder makes sense that it may be executed. However, when you called conda outside of this folder (the second time in your screenshot) you had no executable file named conda to be executed. If you wanted to call the command conda without the need of being in the Anaconda2 folder, you should have made this command be inside your PATH variable. Probably that's what the install manager asked you to do and you refused (maybe it recommended you against it because you're dealing with Windows and it may be somewhat different from what happens in Linux).
EDIT:
After taking another look at your screenshot, I saw that the C:\Users\RAdams.GNSMEM\AppData\Local\Continuum\Anaconda2 was, in fact, your environment. You activated this environment and was in the folder C:\Users\RAdams.GNSMEM. Being in this environment makes you able to call the executable files within it even when outside of it. The thing is that you activated snowflakes (and I think that the other environment was automatically deactivated) after that and then deactivated it. So you had no environments loaded when you called conda the last time. Your environments are pretty OK, I guess.
However my school's computer lab put python together, astLib is not a module it contains. I want to install it in/through my home directory. Im very unfamiliar with the use of unix commands.(all I know how to do is change directory, and open python.) I have a website that tries to explain how to do it, but i dont know what to type into my directory, and i dont know how to do the second step which is to add something into .bashrc. Ive seen one stackoverflow question, in which the user had a similar problem, but was told to ask an admin. The lab's admin is no longer on the faculty, and they are looking into a replacement sometime in the next year.
Here is the link: http://astlib.sourceforge.net/?q=install0.3
I am very new to programing, so the instructions on that link were unclear to me.
My question is, what do i have to type into my command prompt, and how do i add the code shown in the link to .bashrc?
Edit: Ok, so now I learned how to go into the .bashrc file, and I copy/paste the line of code into there. I ran the command throught the command prompt, but i get an error message
error: package directory 'astLib' does not exist
Did I put the downloaded file in the wrong directory? (im pretty sure its in my home directory) Did I put the .bashrc code in the wrong place?(i just put it on the bottom of the code)
If you want to install astLib as system module, I recomend that you install it by pip install way
If you don't want to, you should install virtualenv, create you own environment and then install it there.
Maybe this link helps you to install virtualenv: Comprehensive beginner's virtualenv tutorial?
Edit: I've re-read the question and you have only the virtualenv's option
While working in Eclipse with .git is noticed Eclipse makes a nice folder for gitstats in the project folder.
I attemted to use these files to generate gitstats output, but i cant seem to get it done.
Can someone explain to me how to use these files to get gitstats output.
I do have Python, Gnuplot and git installed. All the latest version.
I do understand that i somehow have to run python on the gitstats file. But after hours of trying is still cant manage to find out how. Probably I am doing something simpel wrong cause i cant find much information on how to use GitStats, any help much appreciated.
You should not put the gitstats repository under your project directory (I'm assuming the upper screenshot is of your project directory). You can clone it to a separate directory, and then pass your personal project directory as a parameter, as the doc/INSTALL instructs:
./gitstats /mnt/src/git/project ~/public_html/project
That is a command that needs to be run in a terminal/shell. Of course, you could add an External Tools Configuration in eclipse for it, but not sure if it's worth the trouble, unless you want to run it very often.
After some hours i finnaly got it working, since i noticed some people had the same issue here the solution.
Eclipse wil just clone your git repository as you would with git it self.
When using gitstats make sure you install python27 and not python33.
Set up your PATH variables to python27 files.
Install GNUplot and also add the PATH variable.
If you use windows insted of linux, in order to easely use gitstats run it in git bash. Since gitbash is Shell script and does suppor WC. CMD does not support WC unless you got Unix installed.
If you still have issues running gitbash, recheck PATH varaibles since that is 9 out of 10 times the issue.
Enjoy!