I feel like crying

A forum for general discussion of the Python programming language.

I feel like crying

Postby sudo pip » Sat May 17, 2014 5:29 pm

At times I wonder why I have tried to learn programming for no other reason than fun.

I decided python seems a decent place to start due to it's seemingly friendly conventions* and dynamic blah. So I tried investigating it through terminal using help() and which leads me to why i want to cry...

Somewhere in my fannying about trying to install numpy (a seemingly well used library) I've messed everything up and now when I call help whats me to install X11 and says it's not included. Plus all my previously working stuff like the Csound object has gone missing.

I think i want to cry as now I have no help and no where to turn to and none of my friends do this for fun and am not studying or getting trained to do this, it is literally out of curiosity for investigating games and Artificial intelligence and it's application in music which is what eventually i want to do be able to do. (maybe by the time I have a beard and stroke it and look cool instead of confused)

I've gone from the land of non-destructive computer games where nothing will break the inside of the machine if you can't kill a boss and now I'm scared in the dark wilderness of destructive programming and I'm kinda too fearful to continue investigating as if I execute the wrong goblin I might not have a working computer any more!

Anyways sorry for the horrible first post. I want Python to be my friend, and it is beautifully friendly from what i've been doing so far but I think I have the super wrong grasp of installing libraries.

Sorry background to actual problem, I've used pip, easy_install and virtualenv most recently, I think what i've done with the install of virtual env is somehow messed with the path of where python is looking, have seen this term PYTHONPATH bantered around the net, but almost every package I've seem has some really confusing vague way of describing how to install things, a lot of problems if pip can't find it, and have to d/l something from sourceforge. i think this is my main problem, where to put packages (I put in site packages/2.7*) and how to set them up once they are in place. I think I've essentially been trying to force shapes in the wrong holes. *(also I have not got a clue what is going on with 2.7 and python 3, seems they've done a good job at confusing people with the simplest of labelling strategies)

If anyone wants to know my relative knowledge level I've used visual programming languages like max/msp and quartz composer, have experimented with processing and Csound and supercollider on and off for the past few years. I have been going through the MIT, Stanford intro's to comp sci on youtube, but they are painfully slow sometimes have watched around 6 hours of each course and skipped into years down the course watching the neural net vids and Genetic algorithm ones that fascinate me so much!

I think I learn better from breaking things, so I'm sorry to anyone that thinks I'm an idiot and should slow down, I've gotta start somewhere.

Man this seems like an essay, but please just read this as pure enthusiasm to learn and better myself in this artform.

Ideally I would like to make friends, but having the same problems in pip install virtualfriends ;) Think it's going to the wrong folder or nothing's inside it!! If anyone can help me be a better geek I would be greatly appreciative.

Again sorry, just passionate and a fool.
Last edited by stranac on Sat May 17, 2014 5:52 pm, edited 2 times in total.
Reason: First post lock. Moved to the introduction thread (poster asked). Then moved back, since there is an actual problem involved.
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby stranac » Sat May 17, 2014 6:00 pm

If you're using pip with virtualenv, then the packages should be getting installed to the virtualenv.
That should work fine as long as you're using the pip from the virtualenv and the python from the same virtualenv.
Note that different virtualenvs have nothing to do with one another, or with the system python installation.

If you're installing with the system pip (outside of an virtualenv), pip should be installing them properly, and they should be available to the system python.

As for packages that can't be pip installed, you're not supposed to copy them to site-packages.
You usually just download the package, and run it's setup.py (that will install them properly):
Code: Select all
python setup.py install

The packages for which that's different should let you know in the documentation.

Hope that helps a bit.
Also, welcome to the forum.

If you have questions about installing a specific lib, feel free to ask.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1093
Joined: Thu Feb 07, 2013 3:42 pm

Re: I feel like crying

Postby sudo pip » Sat May 17, 2014 6:08 pm

yeah I used pip outside of virtualenv, that was the most recent object i've messed with, and all the pip installs I've done previously don't work form the terminal anymore.

"If you're using pip with virtualenv, then the packages should be getting installed to the virtualenv.
That should work fine as long as you're using the pip from the virtualenv and the python from the same virtualenv."

I wish I never downloaded virtual env, they said it would be easier for installs it's seemingly buggered up everything that was installed before it and now in terminal after typing python help() it searches, I type modules and doens't run asks me for X11, I think something's gone a little bit more wrong somewhere down the line
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby sudo pip » Sat May 17, 2014 6:50 pm

ok so I have made a folder called dev in my documents folder /user/documents/dev and have run virtualenv from the terminal and inside the DEV folder I have three folders bin, include and lib.

So whenever I pip install from now on do it to it to the prefix doc/dev folder? or copy the packages into the lib/python/sitepacks?

Then what do I do with the setup.py file how to do I run it from the terminal? Do drag and drop into terminal and bash it? I'm so lost I'm so close to giving up as it's frustrating the hell out of me, I just wish I had one friend that does this too.
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby sudo pip » Sat May 17, 2014 7:17 pm

No I've decided I hate python now, why my terminal can't find previously installed packages is making me pull my hair out. I can see the files are still there in the site-packages folder in the library but when I talk in python from the terminal and write for instance:( import anylib ) installed before I get import error.

Spent the last two days actually doing nothing other that writing sudo pip and thought I got the hang of installing things having managed to get Csound working and being able to talk in python from the terminal and make sounds, which was way cool, sadly I wanted to do some clever list manipulation to write a score and use numpy, there ended my love affair with Python. I'm so frustrated I want to pull out my hair.

Why it has to be so complicated or the steps so vaguely described I have no idea. Any other program/software it's put the external component in a folder and it automatically talks to that folder. Seems that way in python except there's an invisible head puck layer added in for just messing with people. And now I can't install csnd inside my dev folder. I hate this so much, I'm just stubborn and don't wanna give up until I solve the problem.
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby stranac » Sat May 17, 2014 7:56 pm

sudo pip wrote:So whenever I pip install from now on do it to it to the prefix doc/dev folder?

You install packages using the pip executable in the bin folder.
You run the python executable in the bin folder to get access to those.

sudo pip wrote: or copy the packages into the lib/python/sitepacks?

No, that would defeat the purpose of virtualenv, which is basically not using the system packages for all your projects.

sudo pip wrote:Then what do I do with the setup.py file how to do I run it from the terminal? Do drag and drop into terminal and bash it?

What? No. How would that even work?
You cd to where the setup.py file is and run the exact command I've shown you. (You might want to add the --user flag to install to your home directory instead of globally)

sudo pip wrote:Spent the last two days actually doing nothing other that writing sudo pip

That could be (at least part of) your problem. You should never use sudo with pip.
If you want stuff installed globally, use a package manager (or whatever it is you mac people do)
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1093
Joined: Thu Feb 07, 2013 3:42 pm

Re: I feel like crying

Postby Crimson King » Sat May 17, 2014 8:01 pm

Hey sudo pip, don't give up on python and virtualenvs yet! they're wonderful tools.

I was going to ask you a few questions about your installation process, but i assumed it would be better to post my way of using virtualenv and pip and then see if that works for you:

Just a couple of questions and suggestions, if you can't manage to work it out i'll create a new virtualenv and post the steps i followed:

1) How did you try to install those packages in your virtualenv?

2) Did you cd into the directory and use 'pip install x-package'?

3) Did you "source your_virtual_folder/bin/activate" before installing any packages or use the pip found in your_virtual_folder/bin/pip? If you didn't use any of those 2 you won't get any packages installed in your virtualenv.

4) if you used any of the options i mentioned in question 3: Did you use it with system-wide privilegies? (sudo pip install?) That won't work as it installs your packages system-wide.

Cheers!
User avatar
Crimson King
 
Posts: 85
Joined: Fri Mar 08, 2013 2:42 pm
Location: Buenos Aires, Argentina

Re: I feel like crying

Postby sudo pip » Sat May 17, 2014 9:07 pm

Thanks for the post guys, it's actually really encouraging, I think I might heading in the right direction again now.

So I've managed to install mingus and mido two midi library tools for composition. I've done that by dragging the pip file from inside where I installed virtual env into terminal so it says something along the lines of:

$ users/me/documents/dev/bin/pip install mido

and seems to have executed perfectly. Is that the right way of doing it? Is there another step with activate now?

So I think what was wrong is that I wasn't using an IDE like idle and typing python into terminal and writing straight into there to talk to the computer in python.

What happens when I want to use python inside terminal again do I just drag the python executable into terminal and access it that way?

Is there a way to make sure my ide or text mate is looking into the right virtualenv folder?

The lengths I've gone for a step sequencer, I now know why so many people choose to produce music with ableton instead of lines of code!
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby sudo pip » Sat May 17, 2014 9:18 pm

ok so draggin that python file from virtual env into terminal allows me to access python and all the installed libraries (the two I have done so far) by import again without a problem

Next to find out how on earth I can manage to get csnd working again and install things properly from source forge/github errrgh. One step forward though after the staircase I just feel down! I was scared about climbing the stairs again but the help here has helped support me back on my feet again! Thank you very much and sorry for being so out of my depth!
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby Crimson King » Sat May 17, 2014 9:25 pm

sudo pip wrote:So I've managed to install mingus and mido two midi library tools for composition. I've done that by dragging the pip file from inside where I installed virtual env into terminal so it says something along the lines of:

$ users/me/documents/dev/bin/pip install mido



I don't understand the part about 'dragging the files into the terminal'

sudo pip wrote:
So I think what was wrong is that I wasn't using an IDE like idle and typing python into terminal and writing straight into there to talk to the computer in python.

What happens when I want to use python inside terminal again do I just drag the python executable into terminal and access it that way?



Idem above.

I just installed both packages doing the following and it worked just fine:

Create the virtualenv directory and cd into it:
Code: Select all
crimsonking@federico-PC:~$ virtualenv sudopip
crimsonking@federico-PC:~$ cd sudopip


Activate the virtualenv:
Code: Select all
crimsonking@federico-PC:~/sudopip$ source bin/activate


Install both packages:
Code: Select all
(sudopip)crimsonking@federico-PC:~/sudopip$ pip install mingus
(sudopip)crimsonking@federico-PC:~/sudopip$ pip install mido


Check if the installation worked as intended:
Code: Select all
(sudopip)crimsonking@federico-PC:~/sudopip$ pip list
argparse (1.2.1)
mido (1.1.5)
mingus (0.4.2.3)
pip (1.5.4)
setuptools (2.2)
wsgiref (0.1.2)


Working from the terminal is fine, using an IDE is fine as well. Use whichever works best for you.
User avatar
Crimson King
 
Posts: 85
Joined: Fri Mar 08, 2013 2:42 pm
Location: Buenos Aires, Argentina

Re: I feel like crying

Postby sudo pip » Sat May 17, 2014 9:49 pm

Crimson King wrote:
I don't understand the part about 'dragging the files into the terminal'



ahh right sorry, it's a little trick that works in osx if you drag a file into the terminal I think it acts as just writing cd /filedirectory, it just lists the file path in terminal so you don't have to type it in.

I'm gonna make another virtualenv and copy your steps exactly. Just to make sure I know I'm doing in the right way and make myself familiar with the process. Thank you ever so much for helping me, I really am grateful :)

I think I must be crazy staying at home staring at code on a saturday night, but I'm so damn passionate about it, i really want to make some creative things with the knowledge I'm trying to acquire over the next few years. I just think the potential for investigation and experimentation is mind blowing with programming languages. Html bores me so the hacking side of things doesn't interest me, but making genetic algorithms that can jam chord progressions with a human player now that excites the hell out of me. Or using sensors like the leap for making interactive art installations with video manipulation now that is where it's at. I know it's a long way away seeing as I can't even install a library, but gotta start somewhere.
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby sudo pip » Sat May 17, 2014 11:26 pm

I'm still pulling out my hair, getting confused why when I use pip search anyPackage I can find what I'm looking for but when I type the exact thing in such as pip install csnd it suddenly can't find it. Same thing happens with Pygame, so i downloaded the package and followed every single step that has been described in this post but getting clang errors now.


Code: Select all

(DEV)Richards-MacBook-Pro-6:pygame-1.9.1release MouldySoul$ python setup.py install
running install
running build
running build_py
running build_ext
building 'pygame._numericsurfarray' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -I/NEED_INC_PATH_FIX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_numericsurfarray.c -o build/temp.macosx-10.8-intel-2.7/src/_numericsurfarray.o
clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
error: command 'clang' failed with exit status 1
(DEV)Richards-MacBook-Pro-6:pygame-1.9.1release MouldySoul$


CD'ed to the folder I want to install from (pygame) while running source bin/activate so i'm in the right virtual env, typed in python setup.py install and got that horrible error message it looks like it started to work. I have seen this line: clang: error: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future] quite a few times now, what have i done to clang! poor clang I've broken you.

I'm pretty sure that should have worked. I'm pretty sure i've broken my computer.
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby sudo pip » Sat May 17, 2014 11:53 pm

Just to make sure everyone knows how much of an idiot I am and how absolutely and truly screwed I am:

Code: Select all
 File "numpy/core/setup.py", line 682, in get_mathlib_info
    raise RuntimeError("Broken toolchain: cannot link a simple C program")
RuntimeError: Broken toolchain: cannot link a simple C program


Broken toolchain = what have I done!! I've done something fatally wrong here. I followed all the steps to the t so I know something's seriously wrong here.
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby stranac » Sun May 18, 2014 12:15 am

A quick google search says this is a bug in xcode.
Try running:
Code: Select all
ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip install whatever

The same thing should work for setup.py as well.
Friendship is magic!

R.I.P. Tracy M. You will be missed.
User avatar
stranac
 
Posts: 1093
Joined: Thu Feb 07, 2013 3:42 pm

Re: I feel like crying

Postby sudo pip » Sun May 18, 2014 1:06 am

thanks stranac! I just found something very similar on stack overflow
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby sudo pip » Sun May 18, 2014 5:01 pm

So i just don't even know where to start, what to make of hacking that process on installing numpy, seems fraught with hard errors and warnings, and a whole process of converting longs to ints fro arrays, I don't know much but seems converting all the longs to ints is just gonna mess with everything if I try and do something with numpy i won't get the right results.

That hack looks like the worst thing in the world from the 1000+ lines of errors that terminal spued at me and that's pretty much the only option you can find.

Also tried your ARCHFLAGS method with pygame and this happened:

Code: Select all
copying examples/testsprite.py -> build/lib.macosx-10.8-x86_64-2.7/pygame/examples
copying examples/vgrade.py -> build/lib.macosx-10.8-x86_64-2.7/pygame/examples
running build_ext
building 'pygame._numericsurfarray' extension
creating build/temp.macosx-10.8-x86_64-2.7
creating build/temp.macosx-10.8-x86_64-2.7/src
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -Wno-error=unused-command-line-argument-hard-error-in-future -Wno-error=unused-command-line-argument-hard-error-in-future -pipe -Wno-error=unused-command-line-argument-hard-error-in-future -I/NEED_INC_PATH_FIX -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/_numericsurfarray.c -o build/temp.macosx-10.8-x86_64-2.7/src/_numericsurfarray.o
clang: warning: unknown argument: '-mno-fused-madd' [-Wunused-command-line-argument-hard-error-in-future]
clang: note: this will be a hard error (cannot be downgraded to a warning) in the future
clang: warning: argument unused during compilation: '-mno-fused-madd'
In file included from src/_numericsurfarray.c:23:
src/pygame.h:106:10: fatal error: 'SDL.h' file not found
#include <SDL.h>
         ^
1 error generated.
error: command 'clang' failed with exit status 1


it worked for a bit then died on me with the clang '-mno-fused-madd' again.

At this stage it's been another two days of hell with nothing to show for it. Not even doing anything like experimenting or playing just ruthless failure after failure, is this what working in coding is like? I should have stayed in Xcode, I've probably managed to break that in the process of hacking my machine.

HATE virtualenv, sudo installed packages were working fine before this, virtual env has been the worst possible addition to my learning and has screwed everything up, how do I uninstall packages?
sudo pip
 
Posts: 11
Joined: Sat May 17, 2014 4:48 pm

Re: I feel like crying

Postby Crimson King » Sun May 18, 2014 5:33 pm

To uninstall packages you just

Code: Select all
pip uninstall package_name


I'm not going to tell you not to give up, but wouldn't it feel good to solve this issue after all the time you spent trying to get it to work?
User avatar
Crimson King
 
Posts: 85
Joined: Fri Mar 08, 2013 2:42 pm
Location: Buenos Aires, Argentina

Re: I feel like crying

Postby Kebap » Mon May 19, 2014 9:53 am

If you are just starting out, maybe ignore virtualenv for now, and just work with python. Get to know the actual language and leave the operating systems problems.

The disadvantage will be, all the packages you install, will be available for your python everywhere. Nothing too shabby for beginners.

Disclaimer: I also started crying last time I tried virtualenv. I haven't got it running up until now, but also had no utter need for it really.
Learn: How To Ask Questions The Smart Way
Join the #python-forum IRC channel on irc.freenode.net and chat with uns directly!
Kebap
 
Posts: 377
Joined: Thu Apr 04, 2013 1:17 pm
Location: Germany, Europe


Return to General Discussions

Who is online

Users browsing this forum: No registered users and 2 guests