[beta] Python 3.10 - How to install the fedex package

A few years ago I needed the fedex package, I asked and you (Anvil) added it to the standard Anvil ecosystem. It has worked and it’s still working. Thank you!

Last week I got a new computer, I tried to create an Anvil37 environment identical to the one I had on the old computer, but pip install fedex didn’t work.

Today I tried creating a new app, selecting Python 3.10 Standard, adding fedex to the list of packages, but the installation didn’t work.

On my computer I was able to install fedex after some serious struggling and I documented the steps. Here is the readme.txt that I have added to the app that uses it:

# the order of the installations is important, suds must be installed after
# fedex, see https://github.com/python-fedex-devs/python-fedex/issues/158
# and https://github.com/python-fedex-devs/python-fedex/issues/166

conda activate
conda env remove --name Anvil37

conda create --name Anvil37 python=3.7 pandas bokeh graphviz Pillow requests

conda activate Anvil37
pip install setuptools==57.5.0
pip install fedex
pip install suds anvil-uplink

The mess on my local installation is increased by the fact that I use Anaconda to make it easier to install pandas on Windows, but fedex and other packages are not available in Anaconda.


So my question are:

  • How do I install fedex on Python 3.10?
  • Does the silly process I had to go through make sense or am I missing something?

The short answer is that the latest released version of that package is broken (or rather, depends on a broken package). According to this GitHub issue, the maintainer has committed a fix but not yet released it on PyPI. However, that issue also contains a fix: installing git+https://github.com/python-fedex-devs/python-fedex.git@8d74623123153205d72bb18b774a632ee92972f4 instead of a version from PyPI.

I clicked “Edit requirements.txt directly”, then added that as a line in the file, and voila!

3 Likes

I had not thought about installing directly from git.

And now that I know that I can install directly from git, I can see even more doors opening to installing anything I want.

Great!

1 Like

Sometimes I set up my “almost never changed” but often re-used shared bits of code as its own package repo, built to use pip, but not posted to pypi.

My scripts that rebuild the virtual environments just call one of my own git repos in the requirements.txt to make sure everything always matches across projects nomatter how many times I need to rebuild the venv, so its cool I can now do this directly into my anvil projects without duplicating code!

2 Likes

That’s what I thought when I realized you can pip install directly from git.


Unfortunately in the specific case of the fedex package the pip install from git workaround doesn’t help much. The new package that uses the new dependencies doesn’t work.

At this point I either copy the fedex and the suds packages from my old computer into a new git repository and pip import that, or I rewrite the whole thing using the new APIs provided by FedEx.

I remember writing the UPS module in 2 days and struggling weeks for a similar module with FedEx. Dozens of emails and phone calls and bug reports, with their support telling me that they were using the serious technology based on SOAP and XML, while UPS uses JSON and is for amateurs. Well, I just started rewriting using the new FedEx JSON APIs, and everything seems to be much easier to use.

At the last place I worked at, the guy I worked with was inserting records directly into the shipping PC’s local ship manager SQL database for outbound, then we used a scanned order number as the ref number to call it into ship manager.

That was ages ago though.