Install astLib python module without root access - python

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

Related

pip looking in wrong folder

My issue requires some backstory.
I was having some troubles with pip, so I reinstalled Python. After the reinstall pip began to work, but Pycharm, my IDE, could no longer find Python. When I reinstalled Python it created a new folder for itself (Python310), but Pycharm kept looking in the old folder (Python39). I couldn't figure out how to get Pycharm to look in the new folder. Even deleting and reinstalling it did nothing.
So, I renamed Python310 to Python39 and changed the PATH. Now Pycharm can find Python. But pip has developed a new and exciting error. When I try to use it I get the following message:
Fatal error in launcher: Unable to create process using '"C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe" "C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts\pip.exe" install numpy': The system cannot find the file specified.
If I read this correctly pip is still trying to look in Python310. Would you please tell me what I need to do to get pip to looking in the right place?
So, to start. You don't fix this by renaming the folder where the interpreter resides. Even if that worked, it's not a fix. The name will say one thing, but it's actual version, compatible libraries, and anything else tied to the version number would be incorrect.
If you take a close look at the error message from pip, it tells us what's wrong.
Fatal error in launcher: Unable to create process using '"C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe" "C:\Users\user\AppData\Local\Programs\Python\Python39\Scripts\pip.exe" install numpy': The system cannot find the file specified.
You renamed the directory, so your IDE can find it, but pip and everything else using the Python interpreter is still configured to look in the Python39 directory to find it.
The problem you are having is that your IDE, PyCharm, needs to be configured for your project. You have to tell it where the Python interpreter is. The simple solution, you can rename your your Python folder back to it's original state, and add it to your project.
Press Ctrl+Alt+S to open the project Settings/Preferences and go to Project | Python Interpreter. Click the Add Interpreter link next to the list of the available interpreters.
Expand the list of the available interpreters and click the Show All link.
Select the target interpreter.
In your case, look for the one with this file path: "C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe"
I would recommend going one step futher and create an interpreter in a virtual environment. Especially if you are interested in Python beyond a very casual hobby. They are unavoidable.
This link is a good source and can help you with this:
https://www.jetbrains.com/help/pycharm/configuring-python-interpreter.html#interpreter
There, you will find screenshots that follow the steps I listed above. There are also detailed instructions on how to create and add a new interpreter in a virtual environment. The relevant headings are as follows:
Configure a Python interpreter
Python interpreters in PyCharm
Setting an existing Python interpreter
Creating a new Python interpreter
The rest of the content is great as well, and may help answer questions you didn't know you had.
try to uninstall all of the existing python versions. and install it again. using any of application allow you to delete most of files, so to prevent error when re-install .
Option 1:
delete and reinstall again. and then when creating a project it should prompt you to pick a basic interpreter, choose python310 or whatever version you're using.
Option 2:
use a different IDE.

Can't set virtualenv - problem with source activation.ps1

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.

Pip Python Installation Issues

I'm pretty new to the community, and new to python. I know the basics. But now I'm trying to download third party modules via pip but everything I do regarding pip displays an error. I know that pip comes with python seeing as the pip file is there.
I am running python 3.6 and windows 10. I have downloaded pip off the internet also but when I try to run the program it says already downloaded. The first time I ran it it said that it was downloading and successfully downloaded so I'm kind of lost.
Thanks!
Sounds like it's already properly installed. pip is a program called from a system terminal, not from a Python prompt. Open up a command prompt and type pip -h see what happens. If this does not print out the help page on how to use pip, and instead you get an error to the effect of:
"pip" is not recognized as an internal or external command, operable program or batch file
You then need to point Windows where to find the program (pip.exe) by adding your Python scripts folder C:\...\Python36-32\Scripts\ to your environment PATH variable. To do this, open the Start menu and search for "environment variables". Open the dialogue and find one named PATH (case doesn't matter). If it doesn't exist, create it. Edit the value and add the file path to the scripts folder to the end using ; as a separator.
As per your comment, if you are getting an access denied windows error this answer from another question may help you.
You need need to be sure either your powershell is being run as administrator, or by creating a virtual environment.
The Installing Packages docs have a great overview, and instructions.
https://packaging.python.org/installing/#use-pip-for-installing

'pip' is not recognized as an internal or external command, operable program or batch file

I'm trying to install Tweepy using pip, but I keep getting this as the response:
I've seen similar problems and people always suggest adding C:\Python34\Scripts to your PATH. Here is what happens when I try and do that:
Then when I do echo %PATH% it doesn't show the path that I added. Using pip still does not work.
How do I make it to where I am able to use pip? I looked through multiple other questions that were VERY similar to mine, but none of the solutions worked.
Thanks for the help in advance!
I would recommend using this guide for adding a new folder to your system path, normally works for me. It goes through a GUI instead of adding through the command line.
http://windowsitpro.com/systems-management/how-can-i-add-new-folder-my-system-path
A second solution is that you can just cd into the directory that contains pip and use it from there each time, but thats only if nothing else works.
It seems like you are using windows so you need to download the get-pip.py and run like this.
Path_to_your_Python.exe\python.exe Path_to_get-pip.py\get-pip.py tweepy
Here is the link for download get-pip.py

Gitstats Eclipse

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!

Categories