lost my leo and much data with it

166 views
Skip to first unread message

andyjim

unread,
Dec 13, 2020, 7:42:01 PM12/13/20
to leo-editor
I updated brew.  It took an hour or more. After the smoke cleared, Leo was gone.  Would not launch (from icon), and I get this error: /usr/local/opt/python/bin/python3.7 /usr/local/bin/leo
-bash: /usr/local/opt/python/bin/python3.7: No such file or directory
Likely I have made things worse in my naive, thrashing attempts to fix it. 
At the very least I need to recover the text data in my leo files but don't know how to do that.

tbp1...@gmail.com

unread,
Dec 13, 2020, 8:08:24 PM12/13/20
to leo-editor
Your actual .leo files are probably still there, where ever they were before.  You could look for them with find.  Then after getting Leo reinstalled, you should be good to go.

Otherwise, there's always the backups :)

andyjim

unread,
Dec 13, 2020, 8:41:31 PM12/13/20
to leo-editor
I may have lost python.  $ python --version yields:  Python 2.7.14 :: Anaconda, Inc.
Thought I was supposed to have python 3.x  Tried to install 3.9 from Python. Says it's installed but doesn't seem to be.
should I just run a leo install anyway? What install command should I use?  MacOS

andyjim

unread,
Dec 13, 2020, 8:45:54 PM12/13/20
to leo-editor
$ leo  gives: jam$ leo
-bash: /usr/local/bin/leo: /usr/local/opt/python/bin/python3.7: bad interpreter: No such file or directory

tbp1...@gmail.com

unread,
Dec 13, 2020, 11:22:59 PM12/13/20
to leo-editor
Many systems have both Python 2.7x and Python 3.x.  On several Linux systems I have, "python" will run Python 2.7x, and "python3" or "python3.8" will run some version of Python 3.  That's probably true for your system, except that the Python 3 installation got borked somehow.

I think you should try to uninstall, repair, or install python 3 using your system's package manager.  If you still can't install Python 3.9, see if you can install Python 3.8.  On one of my systems, I have both Python 3.6 and Python 3.8 installed and running. Python3 and Python3.6 invoke Python 3.6, and Python3.8 invokes Python 3.8.

Once you have python 3.x working again, install all the packages you need, such as Leo, using the "-m" flag like this -

python3.8 -m pip install leo

This technique will make sure that python tries to run the right version of pip, and that the packages will be installed into the right version of Python. (The "-m" flag tells Python to load a module of that name rather than a file.  Since Python will search its own search path for that module, it will find the right version of pip.)  In the same vein, I normally launch Leo using the "-m" flag -

python3.8 -m leo.core.runLeo

tbp1...@gmail.com

unread,
Dec 14, 2020, 6:32:20 AM12/14/20
to leo-editor
Of course, if brew was your only package manager, I suppose my suggestions above might not work out so well...

Edward K. Ream

unread,
Dec 14, 2020, 7:47:10 AM12/14/20
to leo-editor
On Sun, Dec 13, 2020 at 7:08 PM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
Your actual .leo files are probably still there, where ever they were before.  You could look for them with find.  Then after getting Leo reinstalled, you should be good to go.

I agree. You didn't store .leo files in usr/local/opt did you?

Edward

tbp1...@gmail.com

unread,
Dec 14, 2020, 8:48:14 AM12/14/20
to leo-editor
This may be a helpful starting point on what went wrong -

andyjim

unread,
Dec 14, 2020, 10:50:17 PM12/14/20
to leo-editor
no, my files were/are in Users/jam/.leo  There are a few .leo files there, but the only one that might be it (the primary file I wrote in since March) has only March entries in it.  Confusing. Mac Finder says it was created, last modified and last opened at 7:39pm on March 31.  Seems strange.  I stopped paying attention to the name of the file, Leo just opened it every day and I continued writing in it, not thinking about the name, so I cannot be certain the March 31 file I find is it, but if so, it's somehow lost all data since March 31.  Other leo system files in that directory are dated 12-12-2020, which is the day this happened, so that appears to be the active leo directory at the time.
My focus now is on finding that file.  It's more important than what went wrong.  I currently have a grep search going for a text phrase that I know is in the file (but can be in several others as well)  Been going for several hours only on the Users/jam directory.  It has so far found seven files containing the phrase, none of which contain the lost data.
Could the March 31 file have gotten corrupted, fragmented?  If so, it seems I should still be able to find the raw data on the drive.  I lost an important file five years ago, on Windows at the time, and was fortunate enough to  locate the data on the drive with a specialized data finding program.  Anyone know of a good one for Mac?  I'll see if I can find that program again but don't know if it works on Mac.

andyjim

unread,
Dec 14, 2020, 10:55:24 PM12/14/20
to leo-editor
no, my files were/are in Users/jam/.leo  There are a few .leo files there, but the only one that might be it (the primary file I wrote in since March) has only March entries in it.  Confusing. Mac Finder says it was created, last modified and last opened at 7:39pm on March 31.  Seems strange.  I stopped paying attention to the name of the file, Leo just opened it every day and I continued writing in it, not thinking about the name, so I cannot be certain the March 31 file I find is it, but if so, it's somehow lost all data since March 31.  Other leo system files in that directory are dated 12-12-2020, which is the day this happened, so that appears to be the active leo directory at the time.
My focus now is on finding that file.  It's more important than what went wrong.  I currently have a grep search going for a text phrase that I know is in the file (but can be in several others as well)  Been going for several hours only on the Users/jam directory.  It has so far found seven files containing the phrase, none of which contain the lost data.
Could the March 31 file have gotten corrupted, fragmented?  If so, it seems I should still be able to find the raw data on the drive.  I lost an important file five years ago, on Windows at the time, and was fortunate enough to  locate the data on the drive with a specialized data finding program.  Anyone know of a good one for Mac?  I'll see if I can find that program again but don't know if it works on Mac.
On Monday, December 14, 2020 at 7:47:10 AM UTC-5 Edward K. Ream wrote:

tbp1...@gmail.com

unread,
Dec 15, 2020, 12:16:24 AM12/15/20
to leo-editor
The most obvious thing would be that you never saved it, just kept it open in Leo since March.  But that seems pretty far-fetched.  So let's hope that the correct .leo file has another name!  I tend to hit Save when I have an idle moment.  I also keep a USB backup drive connected all the time, and backup my work directories to it fairly often.  Less commonly, I sometimes put a .leo file in my on-disk Mercurial repository (which is Windows only, so far as I know).  But that doesn't always do the job, especially when much of the work is in @file trees.

Also, I wouldn't be keeping my .leo files in ~/.leo, since that is written to by Leo and who knows what might happen to it sometime if Leo or an Leo installer burps.  What I usually do these days is to create a new .leo file in a project tree I'm working on.  Then I symlink all those .leo files to a standard directory, like (for linux) ~/leo_outlines.  This way, I don't have to remember where all my .leo files are, since I can just go to the leo_outlines directory to find them.

I realize that none of these musings will help you right now.  But going forward once you recover, maybe they might help.

If it were me, I'd search my whole drive for .leo files first, and then grep through them later. It would save a lot of time:

find / -name *.leo -type f 2>/dev/null # or find ~ ...

Also, if you can get Leo reinstalled, the file might show up on the recent files list - and you might recognize the file name there.  Actually, maybe the recent file list is still there and uncorrupted:

~/.leo/.leoRecentFiles.txt

Good luck!

andyjim

unread,
Dec 16, 2020, 8:28:54 PM12/16/20
to leo-editor

Tom, you have saved my bacon. .leoRecentFiles found the missing file, 7 directories deep at usr/local/lib/python3.7/site-packages/Leo/doc/. The file appears uncorrupted, but it seems to be the only copy of that file anywhere on the system. I have made another copy now. And python3.7 is present, although I think python3.9 supplanted it when I installed it. Doesn 't matter I guess, as presumably Leo and Python will find each other.

Now to reinstall Leo and implement a sensible strategy with leo files. Here's what I get with pip install leo:

jam$ pip install leo

Traceback (most recent call last): File "/Users/jam/anaconda2/bin/pip", line 7, in <module> from pip.internal.main import main ImportError: No module named pip.internal.main

Where do I go from here? Thanks.

tbp1...@gmail.com

unread,
Dec 16, 2020, 11:04:48 PM12/16/20
to leo-editor
Since your python installation got completely broken, you will have to specify the one that works.  So first, try to run it:

jam$ python3.6 -m pip list

This will show you if Leo is already installed for python 3.6, and what version.
Pip may not be installed for this version yet.  On some linux systems you have to have your package manager install it. Once you get pip installed, then do

jam$ python3.6 -m pip install leo

Or, if leo is already installed for python3.6 (and it's not Leo v6.3), upgrade it:

jam$ python3.6 -m pip install --upgrade leo

Once installed, invoke it:

jam$ python3.6 -m leo.core.runLeo

It may seem clumsy, using all those python3.6 -m ... commands, but it will make sure that you install Leo and invoke it using the correct working python installation.  If python3.6 isn't working, then you first need to get some version of python3.x installed and working, along with pip.  Then proceed as I have outlined.

Good luck!  Let us know how it turns out.

tbp1...@gmail.com

unread,
Dec 16, 2020, 11:12:17 PM12/16/20
to leo-editor
On Wednesday, December 16, 2020 at 8:28:54 PM UTC-5 andyjim wrote:

Tom, you have saved my bacon. .leoRecentFiles found the missing file, 7 directories deep at usr/local/lib/python3.7/site-packages/Leo/doc/. The file appears uncorrupted, but it seems to be the only copy of that file anywhere on the system. I have made another copy now. And python3.7 is present, although I think python3.9 supplanted it when I installed it. Doesn 't matter I guess, as presumably Leo and Python will find each other.

Once you get a working python + leo system again, move that .leo file (and *all* your .leo files) out of site-packages and somewhere else that is 100% yours to control.  Otherwise, you will still be vulnerable to a broken upgrade, and anyway, once you upgrade to a new major version of Python, it will use a different site-packages directory.

So create a new directory, maybe ~/leo-outlines, if you like, and put them there.  And start keeping backups! :)

Edward K. Ream

unread,
Dec 17, 2020, 7:18:38 AM12/17/20
to leo-editor
On Wed, Dec 16, 2020 at 10:12 PM tbp1...@gmail.com <tbp1...@gmail.com> wrote:

> So create a new directory, maybe ~/leo-outlines, if you like, and put them there.  And start keeping backups! :)

Thanks, Thomas, for your help on this thread.

Edward

tbp1...@gmail.com

unread,
Dec 17, 2020, 8:26:02 AM12/17/20
to leo-editor
:) We all need help sometimes, don't we?

Edward K. Ream

unread,
Dec 17, 2020, 8:27:09 AM12/17/20
to leo-editor
On Thu, Dec 17, 2020 at 7:26 AM tbp1...@gmail.com <tbp1...@gmail.com> wrote:
:) We all need help sometimes, don't we?

Definitely!

Edward

andyjim

unread,
Dec 17, 2020, 9:27:42 AM12/17/20
to leo-editor
Especially us newbies! Thanks all. Here's what I've got so far:

Andrews-iMac:~ jam$ python3.6 -m pip list -bash: python3.6: command not found Andrews-iMac:~ jam$ python3.7 -m pip list -bash: python3.7: command not found Andrews-iMac:~ jam$ python3.9 -m pip list Package Version

pip 20.2.3 setuptools 49.2.1 WARNING: You are using pip version 20.2.3; however, version 20.3.3 is available. You should consider upgrading via the '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python -m pip install --upgrade pip' command. Andrews-iMac:~ jam$ /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python -m pip install --upgrade pip -bash: /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python: No such file or directory Andrews-iMac:~ jam$ /usr/local/Cellar/python/3.9/Frameworks/Python.framework/Versions/3.9/bin/python -m pip install --upgrade pip -bash: /usr/local/Cellar/python/3.9/Frameworks/Python.framework/Versions/3.9/bin/python: No such file or directory Andrews-iMac:~ jam$ python --version Python 2.7.14 :: Anaconda, Inc.

Despite the glitch with pip, it appears I have python3.9, so I went ahead with:

Andrews-iMac:~ jam$ python 3.9 - leo.core.runLeo python: can't open file '3.9': [Errno 2] No such file or directory

andyjim

unread,
Dec 17, 2020, 9:30:29 AM12/17/20
to leo-editor
sorry about the mess there, I don't know how to edit after I've posted

tbp1...@gmail.com

unread,
Dec 17, 2020, 9:51:45 AM12/17/20
to leo-editor
On Thursday, December 17, 2020 at 9:30:29 AM UTC-5 andyjim wrote:

Despite the glitch with pip, it appears I have python3.9, so I went ahead with:

Andrews-iMac:~ jam$ python 3.9 - leo.core.runLeo python: can't open file '3.9': [Errno 2] No such file or directory

 No space after "python" - use python3.9. The way you typed it, Python tried to open a file named "3.9".

There was no glitch with pip.  It's just telling you that there is an update available for pip itself, not that anything is wrong.  Update it when it's convenient; the message tells you the command line to use.

andyjim

unread,
Dec 17, 2020, 10:39:21 AM12/17/20
to leo-editor
Andrews-iMac:~ jam$ python3.9 - leo.core.runLeo
Python 3.9.1 (v3.9.1:1e5d33e9b9, Dec  7 2020, 12:44:01)
[Clang 12.0.0 (clang-1200.0.32.27)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

not sure what's supposed to happen here

andyjim

unread,
Dec 17, 2020, 10:46:49 AM12/17/20
to leo-editor
so I did "help()", then, "modules" and got long list but nothing called "leo"

tbp1...@gmail.com

unread,
Dec 17, 2020, 1:20:39 PM12/17/20
to leo-editor
You left off the "m":

python3.9 -m leo.core.runLeo



On Thursday, December 17, 2020 at 10:39:21 AM UTC-5 andyjim wrote:

andyjim

unread,
Dec 20, 2020, 12:13:32 PM12/20/20
to leo-editor
I am finally making some progress.  Seems something got broken in my system and I don’t quite have it fully repaired yet.  The following might give the best clues as to what I need to do.  After finally getting pip upgraded, and learning that I have to use $ python3.9 command in the terminal, every time, I was finally able to start installing Leo 6.3 (I think my old version was 5.6 or something).  But it seems even Python3.9 is looking the wrong place for something.  Not sure what I need to do next, and how to make sure Python3.9 runs the show top to bottom.
Andrews-iMac:~ jam$ pip --version
-bash: /Library/Frameworks/Python.framework/Versions/3.9/bin/pip: /usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/: bad interpreter: No such file or directory [This is after finally successfully upgrading pip, but $ pip --version  command could not find]
Andrews-iMac:~ jam$ python3.9 -m pip --version
pip 20.3.3 from /Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/pip (python 3.9)
Andrews-iMac:~ jam$ python3.9 -m pip install leo
Collecting leo
  Downloading leo-6.3-py3-none-any.whl (9.7 MB)
     |████████████████████████████████| 9.7 MB 6.4 kB/s
Collecting PyQt5>=5.12
  Downloading PyQt5-5.15.2-5.15.2-cp35.cp36.cp37.cp38.cp39-abi3-macosx_10_13_intel.whl (47.6 MB)
     |████████████████████████████████| 47.6 MB 761 kB/s
Collecting PyQt5-sip<13,>=12.8
  Downloading PyQt5_sip-12.8.1-cp39-cp39-macosx_10_9_x86_64.whl (63 kB)
     |████████████████████████████████| 63 kB 428 kB/s
Collecting pyshortcuts>=1.7
  Downloading pyshortcuts-1.8.0.tar.gz (933 kB)
     |████████████████████████████████| 933 kB 759 kB/s
    ERROR: Error [Errno 2] No such file or directory: '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python' while executing command python setup.py egg_info
ERROR: Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: '/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python'

tbp1...@gmail.com

unread,
Dec 20, 2020, 1:27:12 PM12/20/20
to leo-editor
I don't think I can help you much here, not having a Mac to try things out with. I can see something is going wrong, because something is expecting to find a Python3.7 version and run it during the install, but not finding it.  You are running the install with Python 3.9, so Python 3.7 shouldn't be getting invoked.  This makes me think that Python 3.7 is being invoked by some script that perhaps is trying to use an old (now non-existent) default version of Python.

You could look for all versions of Python on your system with:

find  / -name python*  -type f 2>/dev/null |grep /bin/

This will give you a lot of hits, most of which will be of no interest.  You might find some path that looks similar to the one that didn't exist, but with a different version:

/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/bin/python

The Cellar is a location created by Homebrew, so something about Homebrew must be using a broken script.  But I don't have any knowledge about this subject.  Did you use Homebrew to install Python 3.9?  If not, this might be the cause of the problems, even if I don't see why just now.  I would say that the chances are good that some environmental variable is being set wrong and that some script is using it.  How to fix that is not something I can answer.

It could be time to go to the Homebrew site and ask how to straighten this out.  Alternatively maybe the Python site might be a good choice.  Someone there probably knows a lot about installing with Homebrew on a Mac.

andyjim

unread,
Dec 20, 2020, 7:16:18 PM12/20/20
to leo-editor
I've messed around so much now that I forget if I used homebrew to install python3.9. Mind has poor retention these days, specially since I'm over my head in these waters anyway. Should take notes.  Is there a way I can get a history of terminal commands to see what I've done?
I did decide not to try homebrew to install Leo, but did it with python3.9, being sort of fed up with homebrew since it seemed to mess me up pretty good.
Well, thanks much for all your help.  I'll keep wrestling with it.  Might be getting another used Mac given to me in a couple of weeks, so may have the opportunity to start fresh.

Edward K. Ream

unread,
Dec 21, 2020, 10:47:19 AM12/21/20
to leo-editor

On Sun, Dec 20, 2020 at 6:16 PM andyjim <andy...@gmail.com> wrote:

Should take notes. 

Yes. Get in the habit for all installation-related stuff.

Edward

George Zipperlen

unread,
Dec 22, 2020, 1:45:01 AM12/22/20
to leo-editor
On Sunday, 20 December 2020 at 17:16:18 UTC-7 andyjim wrote:
>  Should take notes.  Is there a way I can get a history of terminal commands to see what I've done?

On the assumption that you are using bash as your shell,
you can set how far back in history it remembers with the

HISTSIZE environment variable in .profile, or .bashrc

    $ man bash


Another trick is the script command to record all your keystrokes in a terminal session.  Can be a lot of cruft,
if you're using a curses based editor, but it's still filterable with unix tools...

    $ man script

Very handy when you are using ssh to do something on a remote system.

On MacOS, I prefer Anaconda to homebrew for keeping different python environments from interfering with
each other.  Once you get over the hump, virtual python environments are wonderful.   Allows me to run old
python2.7 or python3.5 scripts without porting...  Even keeps the appropriate qt versions working.
But I use homebrew for elixir, mutt, and a few other things.
--
George Zipperlen
Reply all
Reply to author
Forward
0 new messages