Sublime Forum

Error on building Python files

#1

Dear support,
when i try to build any .py file, I end up with this error in the output:

dyld: Library not loaded: @rpath/Python Referenced from: /Library/WebServer/Documents/User/bin/python Reason: image not found

I suspect this is due to my recent uninstallation of Entought Canopy, that may have disrupted files used by Sublime Text…

Do you have any idea about how I can fix this?

Thank you.

0 Likes

#2

niccolo,
Firstly, there really is no “support”. It’s just us other users trying to help out where and when possible. :smile:
I suspect this is not really so much a SublimeText (ST) problem or question as it is a general Python configuration question, but I’ll see if I can help a bit here anyway.

It would really be helpful if you could provide some additional information about this problem…
What version and build of ST are you using?
How exactly did you produce this output message? What steps did you execute, in detail? (From starting up ST until you got the error message.)
Where does this message display? In a terminal window, or in the ST "Build Output’ window? Or in the ST Python console?
Is it a Plugin you are trying to run when you get this error message?
(Are you trying to build a Python “package” using the built-in ST ‘Build’ command?
I can’t gauge your Python knowledge level, so I’ll just say that I am confused by your use of the term

". You don’t normally “build” Python 'file’s, individually, you build ‘packages’ if and when necessary, but usually through one of the supplied utilities like distutils or such.
Are you trying to install or re-install a Python package that requires building it, e.g. one of the packages that was originally supplied by Canopy?
You are obviously running on a Mac, judging from the “dyld:” output message, which I am not familiar with, but it looks like it is looking for your Python distribution in a very non-standard location, so yes it could be a path issue left over from your Canopy config, after the uninstall. But that should not affect the Python that comes bundled with ST, AFAIK.)

(Just curious… Why did you uninstall Canopy? What did you not like about it?)

Regards,
Dave

0 Likes

#3

Dear oldwarhorse,
thanks for replying. I couldn’t find the answer anywhere else and decided to post here.

I am running ST3 (3047) on Mavericks. I discovered Canopy after ST and gave it a try, but I greatly valued the ST’s speediness and I went back to it.

The error pops up in the build output window, when I try to run any python code (e.g. a basic FOR loop).

I am just practicing code.

Thank you,
NM

0 Likes

#4

NM,
Hi. Got ya. OK, yeah, I’m gonna say this is definitely NOT primarily an ST issue. I don’t have a Mac and what I know about Mavericks comes from this page right here:
http://www.apple.com/osx/
So, bearing that in mind, I think I remember reading somewhere that ST on OSX uses the ‘system-installed’ Python, and does not bundle its own Python system in. I may be wrong on that, but, it sure sounds like that is the case since trying to run Python outta ST is borked…
I Googled ‘Python on mavericks os’ and got this first thing:
https://support.enthought.com/entries/22861925-OS-X-10-9-Mavericks-Python-Canopy
Excerpt:
"(Revised November 10, 2013 …)
Summary: If Python is a critical part of your work, we do not recommend updating to Mavericks yet.
If you have already updated to Mavericks, several partial workarounds are available.
OS X 10.9 Mavericks was released on October 22. However there are several compatibility issues which may require fixes in Mavericks, Python, Canopy, and (IPython and/or Matplotlib and/or Qt and/or wx); until these are fixed, we do not recommend updating unless you are willing to have your workflow disrupted.
"
So, I’m gonna go out on a limb here and say that’s pretty much your answer right there, for the time being at least.
Numerous known compatibility issues. I’d give that a good read.
But it really sounds like you just need to get your system Python rehabbed and ST should be fine with it.
Wish I could tell you how to do that, but… :wink:
I think your best bet at this point may be to inquire over at the Enthought shop as to how to get things back to spec.
They’s some good ol’ Texas boys and I bet they’d hep ya out. :wink:
Best o’ luck!
Dave

0 Likes

#5

Thank you,
I didn’t realize it could be due to Mavericks - which, incidentally, has created other messes on my Mac with music softwares.

I will head over to the Entought’s crew, hoping they can help.

Thanks a lot for your support.

NM

0 Likes

#6

NM,
You’re certainly welcome. Glad I could “help”, such as it was. I’m hoping it turns out to be as simple as just re-installing whatever version of Python they recommend.
Let us know how it plays out.

Dave

0 Likes

#7

You might also want to try installing the python.org version of Python. Check out this page for some Mac-specific issues and how to fix them. If you’re really bleeding-edge, you can install one of the 3.4.0 release candidates :smile:

Once you have your preferred version of Python installed (MacPorts, python.org, Enthought, whichever), you’ll need to do create a new Python.sublime-build file to point to the correct binary. Let me know which version you end up going with, and if you need additional help I can walk you through the process.

BTW, I haven’t fully upgraded to Mavericks yet, just because of a lot of the issues like this I’ve been hearing about. I’m dual-booting right now, but Mt Lion is my main version, while 10.9 is just a bare install. Hopefully you made a backup before upgrading, so you can downgrade if necessary, or you can just stick it out and keep an eye on updates and workarounds.

Good luck!
Matt

0 Likes

#8

Excellent. I was hoping someone would show up with more and better information.
Thanks, Matt :smile:

0 Likes

#9

I am back guys! Unfortunately installing the Python official distribution doesn’t fix the problem automatically. I will need MattDMo’s priceless help!

Thanks a lot to both of you!

0 Likes

#10

Hi Niccolo,
I assume that you’ve installed the most recent version of Python from python.org, correct? If so, create a new file in Sublime with the following contents:

{
    "cmd": "/Library/Frameworks/Python.framework/Versions/Current/bin/python", "-u", "$file"],
    "file_regex": "^ ]*File \"(...*?)\", line ([0-9]*)",
    "selector": "source.python"
}

Save it as Packages/User/Python_new.sublime-build (where “Packages” is ~/Library/Application Support/Sublime Text 3/Packages, accessible from the Sublime Text -> Preferences -> Browse Packages… menu option). Then, select Tools -> Build System -> Python_new and build your file with ⌘-B.

If you’re still having issues, please let me know exactly which version of Python you installed.

Matt

0 Likes