Skip to content
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

Changes in pymongo 4.9.0 break the build #566

Open
wangyinz opened this issue Sep 21, 2024 · 0 comments
Open

Changes in pymongo 4.9.0 break the build #566

wangyinz opened this issue Sep 21, 2024 · 0 comments
Labels
dependencies Pull requests that update a dependency file

Comments

@wangyinz
Copy link
Member

Turns out there are several major changes in the 4.9.0 version of pymongo, which break our build. One example is in https://github.com/mspass-team/mspass/actions/runs/10966517360/job/30454557775. The error looks like:

#86 [linux/arm64 38/39] RUN python -c "import site; print(site.getsitepackages()[0])" > site_packages_path.txt && 	PYTHON_SITE_PACKAGES_PATH=$(cat site_packages_path.txt) && 	sed -i "s/localhost:27020,/127.0.0.1:27020,/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/encryption_options.py" && 	sed -i 's/HOST = "localhost"/HOST = "127.0.0.1"/g' "${PYTHON_SITE_PACKAGES_PATH}/pymongo/mongo_client.py" && 	sed -i "s/'localhost'/'127.0.0.1'/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/settings.py" && 	sed -i "s/'localhost'/'127.0.0.1'/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/pool.py" && 	rm site_packages_path.txt
#86 0.507 sed: can't read /opt/conda/lib/python3.10/site-packages/pymongo/settings.py: No such file or directory
#86 ERROR: process "/bin/bash -c python -c \"import site; print(site.getsitepackages()[0])\" > site_packages_path.txt && \tPYTHON_SITE_PACKAGES_PATH=$(cat site_packages_path.txt) && \tsed -i \"s/localhost:27020,/127.0.0.1:27020,/g\" \"${PYTHON_SITE_PACKAGES_PATH}/pymongo/encryption_options.py\" && \tsed -i 's/HOST = \"localhost\"/HOST = \"127.0.0.1\"/g' \"${PYTHON_SITE_PACKAGES_PATH}/pymongo/mongo_client.py\" && \tsed -i \"s/'localhost'/'127.0.0.1'/g\" \"${PYTHON_SITE_PACKAGES_PATH}/pymongo/settings.py\" && \tsed -i \"s/'localhost'/'127.0.0.1'/g\" \"${PYTHON_SITE_PACKAGES_PATH}/pymongo/pool.py\" && \trm site_packages_path.txt" did not complete successfully: exit code: 2
------
 > [linux/arm64 38/39] RUN python -c "import site; print(site.getsitepackages()[0])" > site_packages_path.txt && 	PYTHON_SITE_PACKAGES_PATH=$(cat site_packages_path.txt) && 	sed -i "s/localhost:27020,/127.0.0.1:27020,/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/encryption_options.py" && 	sed -i 's/HOST = "localhost"/HOST = "127.0.0.1"/g' "${PYTHON_SITE_PACKAGES_PATH}/pymongo/mongo_client.py" && 	sed -i "s/'localhost'/'127.0.0.1'/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/settings.py" && 	sed -i "s/'localhost'/'127.0.0.1'/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/pool.py" && 	rm site_packages_path.txt:
0.507 sed: can't read /opt/conda/lib/python3.10/site-packages/pymongo/settings.py: No such file or directory
------
Dockerfile:212
--------------------
 211 |     # replace localhost to 127.0.0.1 in pymongo to run on HPC
 212 | >>> RUN python -c "import site; print(site.getsitepackages()[0])" > site_packages_path.txt && \
 213 | >>> 	PYTHON_SITE_PACKAGES_PATH=$(cat site_packages_path.txt) && \
 214 | >>> 	sed -i "s/localhost:27020,/127.0.0.1:27020,/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/encryption_options.py" && \
 215 | >>> 	sed -i 's/HOST = "localhost"/HOST = "127.0.0.1"/g' "${PYTHON_SITE_PACKAGES_PATH}/pymongo/mongo_client.py" && \
 216 | >>> 	sed -i "s/'localhost'/'127.0.0.1'/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/settings.py" && \
 217 | >>> 	sed -i "s/'localhost'/'127.0.0.1'/g" "${PYTHON_SITE_PACKAGES_PATH}/pymongo/pool.py" && \
 218 | >>> 	rm site_packages_path.txt
 219 |     
--------------------

I think this is because the settings.py file got moved or removed. We will need to further investigate.

Also, @Cloud1e ran into another issue due to the reorganization of the modules:
image
I can see that the use of "pymongo.database.Collection" was problematic, but in this version, we need to change it to pymongo.synchronous.collection.Collection.

For now, I just limited the pymongo version to 4.8 with 8ef0ae3. We will need to revisit this later.

@wangyinz wangyinz added the dependencies Pull requests that update a dependency file label Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

1 participant