How to install bpython in Windows

If you would like to test the prowess of bpython and you happen to use a Windows machine, tough luck. By right there is no official support for Windows. bpython officially built and supported in Linux environment only.

If you proceed to pip install bpython you might installed the lib just fine. But when you try to launch it from your terminal you may ask to install additional missing libs which is ftcl and _curses lib.

So how do we go from here? Easy, install unofficial binary of curses from here, http://www.lfd.uci.edu/~gohlke/pythonlibs/#curses

and install bpython by pip install bpython if you did not install it already. You should be able to launch bpython by entering this in your windows terminal, bpython-curses

Tadaa! it’s working now.


For those who wonder why use bpython? I can list down quick point below. bpython should be a good choice as an alternative to the default python interpreter.
a) auto-indent in python interpreter
b) colorful syntax highlighting! Great one. Easy for the eyes.
c) autocomplete and tooltip suggestion as you type inside the interpreter! It’s like a mini IDE!

Can check this video from official bpython website. Quick demo đŸ™‚
https://bpython-interpreter.org/videos/01.ogg

ps, If you wonder what terminal that I use in windows and you guys confusing why I kept referring Windows cmd as a terminal? Here you go, check out my post here, https://izzatz.com/portable-console-emulator-cmder-a-replacement-for-windows-cmd/

Author: Izzat Zainol

Hello there, my name is Izzat Zainol. I'm a Software Engineer based in Penang. I specialized in web development, SAP ABAP, automation scripting, web scraping and desktop application development. Contact me if you'd like to hire me for your next project.

15 thoughts on “How to install bpython in Windows”

  1. Thanks man, works well. For those unfamiliar with Python wheels (like me) you just run “pip install ” in the directory you installed the .whl file. I love bpython! BTW do you know how to get the F8 pastebin working?

  2. I tried it once and it worked.
    Then I deleted the environment where I was working on and I tried the same steps again. It didn’t work, I got errors when I tried to launch bpython-curses.
    Hell, I’m starting to hate Python…

    1. What do you mean you deleted your environment? You mean virtualenv? If yes, please make sure the new environment have the exact library like you installed previously.

      Don’t hate python. Hate Windows. LOL. Switch to Linux :p

  3. Hi there. I’ve installed bpython into an Anaconda installation and… even though I can start bpython through bpython-curses from the shell (cmd), when I try to do anything in there, I get this:

    Exception ignored in:
    Traceback (most recent call last):
    File “c:\anaconda\lib\site-packages\bpython\filelock.py”, line 65, in __del__
    self.release()
    File “c:\anaconda\lib\site-packages\bpython\filelock.py”, line 104, in release
    msvcrt.locking(self.fileobj.fileno(), msvcrt.LK_UNLCK, 1)
    ValueError: I/O operation on closed file

    Tried to look for a resolution…. but nothing works.

    Any idea, please

    Best regards,
    Darek

    1. Hey Darek, it might be a little too late for you but maybe this will help others. I messed around for awhile before figuring out this solution: get the filelock.py file from the master branch on github (https://github.com/bpython/bpython/blob/master/bpython/filelock.py), then manually replace the old filelock.py file on your system (in the bpython folder) with it. Calling bpython-curses in CMDER or another terminal should now work.

  4. Thanks a lot Izzatz for the information. I have bpython up and running in CMDER (using bpython-curses), but I don’t have any syntax highlighting/coloring for the code. Any ideas?

    1. Hi Levi,

      Thanks for dropping by. Regarding the syntax coloring I’m not so sure on that. I’m no longer using bpython for now. But as far as I remember the color syntax automatically followed what we used on cmder.

    1. Miriam,

      If you are on Windows 10, you can try straight ‘pip install bpython’. Have you tried it?

      Anyway, for this curses lib. You need to install the exact version with your python and Windows version. Python 2/3? Windows 32bit/64bit?

      Can you let me know your windows version and python version.

      1. Thanks for your reply.
        Prior to installing the curses I installed bpython using pip. I installed the curses in different ways, also using “pip install windows-curses”.
        I am using win 10 bit, python 3.10.1

        1. Windows 10 32 bit or 64 bit?

          For your reference, the correct file to install is,

          Windows 10, 32 bit –> select **win32.whl
          Windows 10, 64 bit –> select **win_amd64.whl

          1. As mentioned earlier I had installed the correct curses. In my case I have win10, 64 bit and therefor installed **win_amd64.whl.
            Still no change unfortunatly.

          2. hi Izzat
            But how do i install win_amd64.whl?
            Still cannot get bpython to work on windows:(

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.