yt-project / yt

Main yt repository
http://yt-project.org
Other
469 stars 281 forks source link

difficulty importing yt #1150

Closed yt-fido closed 7 years ago

yt-fido commented 8 years ago

Originally reported by: dan mckeown (Bitbucket: danmckeown, GitHub: Unknown)


upon attempting to import yt using canopy I encounter the following error:

AttributeError: 'module' object has no attribute 'utilities' I noticed the following lines in the terminal:

File "init.pxd", line 155, in init yt.utilities.lib.misc_utilities (build/src.macosx-10.6-intel-2.7/yt/utilities/lib/misc_utilities.c:16424)

I have a much later version of osx than 10.6, is this perhaps the reason?


yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


hmm it still didn't work

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


I went ahead and included the final steps I followed which are above. I still wasn't able to import yt, but I am going to restart and see if it works then.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


Save this file (Ctrl-O, then Enter) and exit the text editor (Ctrl-X).

Then run the following to apply the changes.

$ launchctl load ~/Library/LaunchAgents/environment.plist

Note: You may have to restart your computer if the changes did not take effect with the above command.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


here's a link to the article that told me about this: https://support.enthought.com/hc/en-us/articles/204469160-How-do-I-set-PYTHONPATH-and-other-environment-variables-for-Canopy-

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


hello Kacper, There is a breakage or removal of environment variable functionality in launchd.conf for users of OS X 10.10 (Yosemite) and above. A solution is to create an environment.plist file which specifies a PYTHONPATH and is executed at system startup. To do this from Terminal:

$ sudo nano ~/Library/LaunchAgents/environment.plist

this opens up a GNU nano 2.0.6 File

launchctl setenv PYTHONPATH /Users/danmckeown//yt-conda/lib/python2.7/site-packages

yt-fido commented 8 years ago

Original comment by Kacper Kowalik (Bitbucket: xarthisius, GitHub: xarthisius):


/Users/danmckeown/yt-conda/lib/python2.7/site-packages should be added to PYTHONPATH not PATH

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


also site-packages is missing from the path, I don't have it as a file or directory inside python2.7

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


I was unable to get yt to import after after creating the path environment variable by copying and pasting. After running the command yt -help command I got the error:

yt module located at: /Users/danmckeown/yt-conda/lib/python2.7/site-packages

YT site-packages not in path, so you must update this installation manually by committing and merging your modifications to the code before updating to the newest changeset.

so I modified my original PATH environment variable to include the additional directories:

export PATH=/Users/danmckeown/yt-conda/lib/python2.7/site-packages:$PATH

However, yt was still unable to be imported with canopy.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


thanks. that was very helpful. I see that indeed the instructions are given by the program and readable.

You must now modify your PATH variable by prepending:

/Users/danmckeown/yt-conda/bin

On Bash-style shells you can copy/paste the following command to temporarily activate the yt installtion:

export PATH=/Users/danmckeown/yt-conda/bin:$PATH

and on csh-style shells:

setenv PATH /Users/danmckeown/yt-conda/bin:$PATH

I'm just reading up on this PATH variable and making sure I understand Unix better for future.

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


The PATH environment variable is what a unix-like operation system uses to determine where to find executables. In this case, the python executable. You need to prepend your PATH with the location where you installed yt using the get_yt.sh script. You can do this as a one-off command or by editing your .bashrc.

The get_yt.sh script should have printed the exact sequence of commands you need to do to do this. It will be something like:

#!bash

$ export PATH=/path/to/yt-conda:$PATH
yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


and again, thanks for all your help.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


oh ok. I'm not sure what pretend your PATH environment variable means. I looked into this but I got alot of results where they were doing something totally different so it was a little tough to put into context. I do know that if I accomplish this last step then yt should be up and running, since it's already installed it just needs to be recognized by by canopy installation. If you have any clear steps to get this last step accomplished feel free to shoot me an email. I'll keep looking into this, definetely made a lot of progress.

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


No, the get_yt.sh script is a completely separate python installation. I'm still not sure what was going wrong with your original canopy installation and I'm not sure what needs to change so you can use yt with it.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


Does that mean I just need to fix my directories structure so that canopy will now recognize yt?

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


Managed to successfully install yt in the end.

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


There is no activate script with the get_yt.sh script. You just need to pretend your PATH environment variable with the installation location.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


ok great Nathan, it installed and I know it did because it ran through all the different python modules and when I use yt --help I get the full list of line arguments and subcommands One last thing, I can't seem to activate my installion. When I run the command

source /bin/activate I get the error

Dans-MacBook-Pro:~ danmckeown$ source /bin/activate -bash: /bin/activate: Operation not permitted

I noticed there are manual instructions, but I'm not quite sure I follow them. By the way, thanks alot I know I'm almost there.

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


Hi, yes, the install script doesn't work on El Capitan unforuntately.

Can you try the alterinate get_yt.sh script? You can get it here:

https://bitbucket.org/yt_analysis/yt/raw/d9502d84802972ba3e644d2d5c47b87f73a6bd08/doc/get_yt.sh

This script uses miniconda python and bundles its own OpenSSL installation.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


hi Nathan, I went back and tried a reinstall using the one line. I almost got it to work! But, at the very end, after it had gone through many prompts, I got the following error, which I included below.

http://paste.yt-project.org/show/6121/

I looked up the error, tried a fix, and got a message that my version of osx was unsupported.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


hello Nathan, still the same error coming up as 'utilities'. I'll keep working on this too. Thanks for your input so far. This is a really great development environment. I am really looking forward to getting it all set up and digging in to research with it this coming semester.

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


One more thought, can you pastebin the full output from:

#!bash

$ pip uninstall yt
$ pip install yt
yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


thanks Nathan

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


OK, in that case I'm not sure what's going wrong here. Sorry I couldn't be more helpful... I will try to reproduce this after I get back to the office on the 4th.

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


it gave an error for xcode-select --install

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


OK, one last thing to try before I try to reproduce this (which unfortunately will take a few days because I don't have ready access to a box with 10.11 on it), is to try to install the xcode command line tools, and then reinstall yt. In a terminal, do the following:

#!bash

$ xcode-select --install
# click install on the box that pops up
$ pip uninstall yt
$ pip install yt
yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


also Canopy Python 2.7.6

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


Sure thanks canopyversion 1.5.2.2785 osx version 10.11.2 elcapitan

http://paste.yt-project.org/raw/6120//

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


Hmm, so I think you should have gotten the binary wheel builds we have on pypi, so no you don't need a C compiler.

Can you show me the full error message you receive when you import yt? Please use a pastebin service (like paste.yt-project.org) to avoid garbling the error by directly copying and pasting it here. Can you also tell me which OSX, python, and canopy version you're using?

yt-fido commented 8 years ago

Original comment by dan mckeown (Bitbucket: danmckeown, GitHub: Unknown):


Hi Nathan, I installed with pip. I read that I needed a C/C++ compiler so I went and got devtools xcode from the appstore before I installed with pip. Was there another step I was missing perhaps?

yt-fido commented 8 years ago

Original comment by Nathan Goldbaum (Bitbucket: ngoldbaum, GitHub: ngoldbaum):


How did you install yt? This error happens when yt's C extensions have not been compiled correctly.