Replies: 2 comments 1 reply
-
|
Hi Jonathon.
Thanks for your email and your kind words. I'm thrilled you are enjoying
my book.
As luck (?!?!?) would have it, I was on PythonAnywhere yesterday evening
and the same thing happened to me. Turns out MariaDB updated their
database driver in such a way that it stopped working with the DBcm/MySQL
combo. Not to worry, though, there's a simple fix. At the PythonAnywhere
*Bash* console, type the following command:
python -m pip install --user --upgrade DBcm==2.1
This installs a version of DBcm which works with any MySQL server. The v3
release of DBcm (the most recent) has been updated to target MariaDB. (So
much for MySQL and MariaDB being nearly 100% compatible... sigh).
Sorry for the trouble. Let me know if this fixes things for you, and happy
travels on your future Python journey. 😎
Cheers.
Paul.
…On Wed, 13 Nov 2024 at 06:23, Jonathan Spark ***@***.***> wrote:
Kia Ora from Aotearoa New Zealand 🙂
I've made it through almost all of your most excellent book, but I've
struck an issue in the part in chapter 12 where I need to install DBcm into
my PythonAnywhere (page 590). The pip command exits with an error when
installing the mariadb dependency:
4:06 ~ $ python3 -m pip install DBcm
Defaulting to user installation because normal site-packages is not writeable
Looking in links: /usr/share/pip-wheels
Collecting DBcm
Using cached dbcm-3.0.3-py3-none-any.whl (4.2 kB)
Collecting mariadb
Using cached mariadb-1.1.10.tar.gz (84 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [30 lines of output]
/bin/sh: 1: mariadb_config: not found
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 363, in <module>
main()
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 345, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
File "/usr/local/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 130, in get_requires_for_build_wheel
return hook(config_settings)
File "/tmp/pip-build-env-t_zdczcv/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 334, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=[])
File "/tmp/pip-build-env-t_zdczcv/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 304, in _get_build_requires
self.run_setup()
File "/tmp/pip-build-env-t_zdczcv/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 522, in run_setup
super().run_setup(setup_script=setup_script)
File "/tmp/pip-build-env-t_zdczcv/overlay/lib/python3.10/site-packages/setuptools/build_meta.py", line 320, in run_setup
exec(code, locals())
File "<string>", line 27, in <module>
File "/tmp/pip-install-ymczezx7/mariadb_a20187ccffb2499fb44da1c69726e785/mariadb_posix.py", line 62, in get_config
cc_version = mariadb_config(config_prg, "cc_version")
File "/tmp/pip-install-ymczezx7/mariadb_a20187ccffb2499fb44da1c69726e785/mariadb_posix.py", line 28, in mariadb_config
raise EnvironmentError(
OSError: mariadb_config not found.
This error typically indicates that MariaDB Connector/C, a dependency which
must be preinstalled, is not found.
If MariaDB Connector/C is not installed, see installation instructions
If MariaDB Connector/C is installed, either set the environment variable
MARIADB_CONFIG or edit the configuration file 'site.cfg' to set the
'mariadb_config' option to the file location of the mariadb_config utility.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
I had this same error when trying to install it on my local machine, but
was able to resolve it by installing the "mariadb-connector-c-devel"
package on my host OS (Fedora). However, I'm not sure how or if this can be
done in PythonAnywhere?
Thanks again for the great book ❤️
—
Reply to this email directly, view it on GitHub
<#8>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A7O3GTH2FZ276AEBXDQDYKT2ALV57AVCNFSM6AAAAABRVWSU7SVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZXGQ3TINBUHA>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
--
Paul Barry
MSc, BSc, PG Cert (T&L)
Lecturer - Department of Computing
E ***@***.*** | *setu.ie* <https://setu.ie> | work
E ***@***.*** | personal
[image: turn on images] <https://setu.ie>
Kilkenny Road Campus, Kilkenny Road, Carlow, R93 V960, Ireland
Campas Bhóthar Chill Chainnigh, Bóthar Chill Chainnigh, Ceatharlach, R93
V960, Éire
|
Beta Was this translation helpful? Give feedback.
1 reply
-
|
Hey, you're welcome - I'm happy to help.
I did not know about that specific change to f-strings in 12... emmm... not
sure I like it as I think the "old way" is neater (to me, anyway).
Delighted all is good for you now, and congrats on making it to the end of
the third edition of Head First Python. 🙂
Paul.
…On Thu, 14 Nov 2024 at 08:08, Jonathan Spark ***@***.***> wrote:
Hi Paul,
Thank you for the quick response! It indeed worked and got me going again
with installing DBcm into my PythonAnywhere environment.
I had tried (unsuccessfully) installing earlier versions of the v3 series
of DBcm, but I didn't think of trying the earlier v2 versions as I didn't
twig to the fact that I didn't need SQLite3 support any longer now that the
webapp was using MariaDB/MySQL 🤦
Once I got the DBcm installed, I then struck another issue where it was
giving the following error:
title = f"{session["name"]} (Under {session["age"]}) {distance} {stroke} - {session["chosen_date"]}"
^^^^
SyntaxError: f-string: unmatched '['
After a bit of thinking and searching online, I found that I was being
tripped up by the different Python versions in PythonAnywhere (3.10) and my
local machine (3.12), as the improvements in f-string interpolation
introduced in 3.12 allows one to use the same quote type that is enclosing
the f-string within an interpolation expression. A quick change of the
f-string to use single quotes in the code then got my webapp up and running
on PythonAnywhere:
title = f"{session['name']} (Under {session['age']}) {distance} {stroke} -
{session['chosen_date']}"
I can now proudly report that I've completed the book 🎆
Thank you so much for your help.
—
Reply to this email directly, view it on GitHub
<#8 (reply in thread)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/A7O3GTGRCU7SXRJSRG36V5L2ARK7VAVCNFSM6AAAAABRVWSU7SVHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCMRVGEYDAOA>
.
You are receiving this because you commented.Message ID:
***@***.***>
--
Paul Barry
MSc, BSc, PG Cert (T&L)
Lecturer - Department of Computing
E ***@***.*** | *setu.ie* <https://setu.ie> | work
E ***@***.*** | personal
[image: turn on images] <https://setu.ie>
Kilkenny Road Campus, Kilkenny Road, Carlow, R93 V960, Ireland
Campas Bhóthar Chill Chainnigh, Bóthar Chill Chainnigh, Ceatharlach, R93
V960, Éire
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Kia Ora from Aotearoa New Zealand 🙂
I've made it through almost all of your most excellent book, but I've struck an issue in the part in chapter 12 where I need to install DBcm into my PythonAnywhere (page 590). The pip command exits with an error when installing the mariadb dependency:
I had this same error when trying to install it on my local machine, but was able to resolve it by installing the "mariadb-connector-c-devel" package on my host OS (Fedora). However, I'm not sure how or if this can be done in PythonAnywhere?
Thanks again for the great book ❤️
Beta Was this translation helpful? Give feedback.
All reactions