-
-
Notifications
You must be signed in to change notification settings - Fork 815
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS Monterey 12.3 no longer has Python 2.7 installed, finding it very difficult to use sqlite3 #1552
Comments
I had the same problem (M1 Mac, just updated), I've downloaded python 2.7.18 from python.org and duplicated my terminal.app, set it to use rosetta and now it works. It is not optimal but for now the only option I could find. |
Thanks, I didn't actually think of downloading an installer from the official site, almost seems a bit old school, but I tried it and it worked! |
I install 2.7.18 through pyenv it work for me. |
Same problem...M1 with MacOS 12.3 |
the root of the problem is the bundled sqlite3 tar file I'm using HomeBrew, and therefore:
with this, I can run:
|
Having the same issue. Aside from reinstalling python 2.7 along with the existing installation there is no solution for this now? |
This is because of the python invocation in
|
@mohd-akram - thanks that works locally but i tried the same in a dockerfile and it complains about the python executable. Any ideas on how to build a docker image? |
That command modifies the config for the current user. It's possible that you're running For production it's better to just use the |
Sorry I'm a mac noob here; in my linux box i would just set a symbolic link to python3 and call it python. When i try to do that on the mac it just prompts me to install command line tools which are already installed. Then, I've set the variable globally with |
Even if you do a symlink this cant be build with python3. Since it is python2. Here is the alias for your .rc file though (if you installed python3 with homebrew):
|
This worked for me
|
Hello! After your steps I also get the error: Maybe I understand you wrong but where I should write the following code: "export PATH="${HOME}/.pyenv/shims:${PATH}"" ? In console? |
Yes in console |
macos no longer support python@2. can we update the script to python@3? |
Where does the requirement for node-gyp@3.8.0 come from? Node-gyp is up to version 9 now. 3.8.0 requires python 2.7. The latest version requires python 3.7 - 3.10. v3.8.0 is not a dependency of node-sqlite3. It depends on version 7.x. in package.json. I had no problems on Mac M1 using @vscode/sqlite3. Not sure what the difference is with node-sqlite3. Am now trying to use node-sqlite3 in Windows running on qemu virtual machine on a Mac M1 and getting same problems as above. Also get a lot of deprecation warnings. |
Discussion here and suggestion to change"
to:
At least that upgrades node-gyp to version 7. It requires python v2.7, v3.5, v3.6, v3.7, or v3.8. |
What worked for me on M1 MacOS Monterey 12.3. Install Python2.7 via Pyenv (Step 1 and 2, as instructed by @guidone above). Find the directory where Python2 is installed, In my case it was Then export to your NPM config.
check if that is configured by listing the config:
It should be listed as follows.
Run the installation. |
For me it was enough to install node-gyp as a devDependency - now the build is working with python3 |
I tried all this and I'm still getting a bunch of errors like
It looks like it's an issue with node-gyp so I tried to run "node-gyp rebuild" but I'm getting another error:
Basically I'm looping through errors. I'm also on a Macbook with MacOS Monterey 12.3. Incidentally, on my Macmini running Monterey 12.1 everything works fine. |
@landodesign I have gone back to using:
and it works fine. It installs the mapbox sqlite3 but seems to work better. And uses python3. If you try this I suggest make the change in package.json, delete package-lock.json and delete your project's node_modules folder then run Not sure if this is relevant, but if I do
I am using a MacBook Pro with an M1 chip running Monterey 12.3. Hope that helps with your trouble-shooting. |
After trying different solutions, I managed to make it work by downgrading Nodejs version from 17 to 12! So just to sum it up: |
Note that python 2.7 reached EOL over 2 years ago, and has not -nor ever will- received security fixes since. The same goes for Node 12 a few days from now: that reached EOL on the 23rd of this month, and will never receive security updates ever again either. So the real fix here needs to come from mapbox here. |
If you need |
Also note that the advice above to first explicitly install the current version of |
refs https://github.com/nodejs/node-gyp/blob/f5fa6b86fd2847ca8c1996102f43d44f98780c4a/lib/find-python.js refs #1552 - Monterey 12.3 removed Python 2, so `node-sqlite3` doesn't build because the v3 binary is called `python3` and therefore `python` is missing - `node-gyp` has logic to find the python binary and stores it in the `PYTHON` env variable - we should be able to switch to using that
I'm on it 🙂 Fix will be landing in |
refs https://github.com/nodejs/node-gyp/blob/f5fa6b86fd2847ca8c1996102f43d44f98780c4a/lib/find-python.js refs #1552 - Monterey 12.3 removed Python 2, so `node-sqlite3` doesn't build because the v3 binary is called `python3` and therefore `python` is missing - `node-gyp` has logic to find the python binary and stores it in the `PYTHON` env variable - we should be able to switch to using that
This should be fixed in |
I had some issues with Thank you mate |
@Fedeorlandau node-sass has been deprecated for a very long time now, you should be able to switch to the normal sass package without any problems and without needing a dead version of Python. |
For those using
This will add that config to Also I made sure to undo as much of the previous given solutions in the other files like: And finally I had to remove the Then when running |
Did you ever find a solution to the syntax error? Having the same issue |
@christopher-caldwell the solution kind of really is "use the current versions of python and node, and first explicitly install the latest version of (The oldest still supported versions of python and node here are 3.7, and 14, respectively) There really is no reason to need python 2.7 for any of this, the only thing that matters is that you're running the latest node-gyp with a python version that it supports (supported versions are always listed in https://github.com/nodejs/node-gyp#on-unix), because it only needs python to run its own compile-specific python code. So the only thing that can go wrong here is that npm picks an ancient/dead version of node-gyp, to which the solution is "make npm not do that, by locally installing the latest node-gyp". |
@daniellockyer I see this same error on 5.0.3. Doesnt seem fixed. Am I missing something?
|
FYI v5.1.1 now comes with prebuilt Darwin ARM64 binaries 🙂 https://github.com/TryGhost/node-sqlite3/releases/tag/v5.1.1 |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
Yet again: do not install python 2.7, you do not need it and it's a dead, unsupported, security-hole.
The problem here is not sqlite3 itself, the problem is that you're relying on an ancient version of |
Output from
yarn install
I've tried pointing it at
python3
which does come installed but the code relies on python 2.7 syntax.I have also been trying to install python 2.7 back on the system with little luck, homebrew seems to have made it hard to install, and
pyenv
is even having issues on the apple silicon, at least for me, this is with trying workarounds using anotherx86_64
homebrew install and also using a rosetta terminal.I know this isn't really an issue with this library, but Monterey 12.3 came out a few days ago at time of writing, I'd expect to see this question asked a lot in the near future.
And I'd also love some help on how I can either 1: Get this working without installing an old version of python or 2: Somehow get an old version of python running on this system.
Cheers!
The text was updated successfully, but these errors were encountered: