Is there a magnetic field around an electron beam inside a vacuum tube? This question is related to the book I'm reading (Edward M. Purcell, Electricity and Magnetism, third edition). In particular, here is the image from 6.2 chapter (Figure 6.7):

As you can see, the circuit consists of different materials (copper wire, water, vacuum). And here the author claims that

The line integral of B has precisely the same value around every part
of this circuit

This is where I got confused.
Pure water has negative ions moving right and positive ions moving left. Copper wire has conduction electrons and protons. So, in these cases the presence of a magnetic field can be easily explained by relativistic effects.
But what about the vacuum tube? It's just the electrons - nothing more, nothing less. How can the relativity explain the magnetic field in this case?
To provide more context, here is how a magnetic interaction (mutual repulsion) of two conducting wires was explained earlier in the book:

The electron distribution in a wire (from a corresponding frame of reference point) is Lorentz-contracted creating a negative net density. So the wires carrying currents in opposite directions repel each other.
In the case of the vacuum tube in the figure above the existence of the magnetic field seems confusing. What exactly is Lorentz-contracted when there are no other particles except of the electron beam?
I can't wrap my head around this confusion because it looks like a typical catch-22 situation. Is a magnetic field created only during an interaction between different currents? So it isn't really there when we are not measuring. Or does a magnetic field cause these interactions to occur in the first place?
Hope I clarified my doubts well.
 A: Compasses show that there is a magnetic field around a vacuum tube. Except for one compass, the one that co-moves with the electrons.
We can build a LC-circuit where the tube is the inductor, there is the problem that the tube is a capacitor too, because its charge varies. Normal wires have that problem too.
If we manage to build a very long tube and drive a very large current through it, we can use it as a energy storage device. The electrons behave like they had a small amount of extra mass, like they do in a normal wire. Coiling the tube would increase the extra mass greatly.
Oh yes, coiling the tube would make it impossible for any compass to co-move with the electrons.
A wire loop with current is one kind of compass, and relativity explains the turning of that loop near a tube with a current. Other types of compasses will agree with that compass.
A: The reason that Purcell uses the example of two attracting wires to illustrate the existence of magnetic fields is that they are electrically neutral.  This means that in the lab frame, there cannot be an electric force between the wires.  And yet, by looking at the charge densities in another frame, we can show that the wires will experience forces perpendicular to their length.  In the lab frame, this force is explained by the magnetic force between the wires.
It would be possible to make a similar argument by looking only at two opposing beams of charge.  In this case, the two beams would strongly repel each other in the lab frame, due to each other's electric fields;  and we could calculate the expected repulsive force per unit of length.  We could, however, also use the following method to calculate the force between the beams:

*

*Go to one of the beams' rest frames.

*Calculate the force per length of beam there (with the charge densities and the lengths transformed appropriately).  Note that in this frame, the beam is at rest and so only experiences an electric force, which we know how to compute.

*Transform the result back into the lab frame.

If we did this, we would find a different result from what we would expect by simply calculating the electric field in the lab frame.  The discrepancy between these results is explained by the additional magnetic force between the beams.
A: Maxwell's equations state that moving electric charges create a magnetic field around it. That is the case in all of the apparatus that you show, including the vacuum tube. The net result of all the moving charges in all of the different parts is the same current going around the whole apparatus. The same current gives rise to the same magnetic field.
As with all fields, they form a description of what influence a certain phenomenon has on the surrounding area. A single charge has a surrounding electric field. That field describes what would happen if we place another charge at a certain distance from the first charge. But the electric field is still there when there is only single charge. The same is true for the magnetic field. The field exists for a single moving charge, independent of whether any other charges are nearby.
The Relativity viewpoint can give insight into how the magnetic field and electric field are related to each other. The same phenomenon that is explained by the magnetic field in one reference frame, can be explained by the electric field in another reference frame. That does not mean that the magnetic field is somehow caused by Relativity.
We can take the vacuum tube as an example of that. Suppose we place a magnetic dipole (a compass) next to the tube. In the stationary reference frame, that dipole will align itself with the magnetic field generated by the moving electrons.
Viewed from a reference frame moving with the electron(s), the electrons are stationary, and therefore don't generate a magnetic field. But in that reference frame the magnetic dipole is moving, and therefore generates an electric field. That electric field interacts with the electrons, causing the dipole to align itself in the same way.
A: Thanks to all the answers and comments. I think, I've finally resolved the problem of this question.
I see there are a lot of misconceptions around the web concerning magnetism and relativity relationship.
So, in the hope it will help others who are confused by the same issues, I'm gonna add a short FAQ below.
Q: Is an electric field a fundamental entity and can a magnetic field be understood as a pure relativistic effect?A: Both an electric field and a magnetic field are fundamental phenomena. What relativity tells us is that everything depends on the chosen reference frame. From one viewpoint the magnetic field can be observed as a pure relativistic effect. From another viewpoint the observers see the world differently and, consequently, may even think that it's the magnetic field that's fundamental and the electric field is just a relativistic effect. Both viewpoints are correct at the same time. A good example of this is Moving magnet and conductor problem.
Q: How can a magnetic field be explained by relativity in a system where Lorentz contraction doesn't change charge densities? Take, for example, two charges moving parallel to each other.A: According to relativity, when one frame moves relative to another one we should consider two effects: Lorentz contraction and time dilation. If Lorentz contraction is negligible for a particular system it doesn't mean relativity laws cannot be applied.
Take a look at the system of two charges moving with the same speed $\vec{v}$ and direction parallel to each other:

In the reference frame where the charges are at rest there is a pure electric force between them which is repulsive (charges have the same sign). It can be calculated using Coulomb's Law.
In the lab frame where the charges are moving to the right the repulsive force is reduced because of time dilation. Lorentz contraction doesn't affect length in the direction perpendicular to the velocity, therefore, the force can be calculated using the following relativistic equation G.17 from Appendix G of Purcell's book: $$ \frac{dp^′_y}{dt^′} = \frac{f_y\Delta{t}}{\gamma\Delta{t}} = 
\frac{f_y}{\gamma} $$
where $ f_y $ is the force between the charges, $ \gamma $ is the Lorentz factor.
At the same time, for observers in the lab frame the force between the charges comprises both electric and magnetic components. So they may decide to calculate it using traditional equations (e.g. Lorentz force).
Both approaches are correct.
Q: Can relativity explain the existence of a magnetic field around a moving charge even when it doesn't interact with the other moving charges?A: Yes. Relativistic laws apply even for a single charged particle moving in a vacuum tube.
From the reference frame where the particle is at rest there is just the electric field.
In the lab frame where the particle is moving with speed $\vec{v}$ its time slows down (time dilation) and its electric field $E$ concentrates in the direction perpendicular to the particle motion because of Lorentz contraction:

These changes of the particle's electric field and its time coordinate can be explained from another viewpoint by magnetic effects. And again both viewpoints would be correct.
Q: Can there be the same magnetic field around different media with flowing charges in a circuit?A: Yes. By looking at Ampère's circuital law we can conclude that the magnetic field is directly proportional to the current. The current $I$ can be defined as $$I=\frac{dQ}{dt}$$
So, it all comes down to measuring how much charge is transferred through the surface over a time $t$.
The charges are flowing with different speed inside the different media. However, we should also take into account the difference between the charge densities. If the charge density compensates the speed variation the current can still be the same. And, as a consequence, there will be the same magnetic field around.
The interaction force, on the contrary, will be different because of the different electric and magnetic field contributions around various conductor materials.
Q: In the example of two current-carrying wires repelling each other why aren't the electrons getting Lorentz contracted in the lab frame? Doesn't it violate the principle of equivalence?A: In fact, the electrons do experience Lorentz contraction in the lab frame. It's just that we specifically chose such a system where the density $\sigma$ of positive ions equals the density $\sigma$ of negative ions in the lab frame.
In a system where $\sigma$ of electrons is increased by $\gamma$ a nearby stationary charge would experience the electric force. However, all relativistic laws would still hold good. As a result, in the rest frame of electrons their density will be $\frac{\gamma\cdot\sigma}{\gamma}=\sigma$ and the density of positive ions will be equal to $\gamma\sigma$.
A: Maxwell's equations describe what has been found experimentally:  Moving charges lead to a measurable magnetic field. Lorentz contractions and the consideration of different reference systems are named as cause.
stuffu writes in his answer: "The electrons behave like they had a small amount of extra mass, like they do in a normal wire. Coiling the tube would increase the extra mass greatly." Where does the extra energy come from that the electrons moving in a circle have? Definitely not from relativistic motion, because when the tube is straight, the electrons move at comparable speeds, but produce a smaller magnetic field.
The solution for the stronger magnetic field of the electric coil must lie in the acceleration of the charges (on their spiral path). At this point it should be pointed out that also a stationary electron has a magnetic field. In the standard model of the elementary particles for the electron not only a unique electric charge is noted, but also an intrinsic (independently of external influences existing) magnetic dipole.
We know that these magnetic dipoles in some materials (the so-called permanent magnets) stabilize each other and lead to a macroscopically noticeable magnetic field. And that at low temperatures the effect also occurs at room temperatures in non-magnetic materials - or is disturbed (destroyed) at higher temperatures (Curie point) because of the stronger thermal motion of the atoms.
To make a long story short, the cause of the collective magnetic field of moving electrons lies in the forced common alignment of their magnetic dipoles. The example of an electron flow through different materials given by Purcell is a perfect example of this. It is, after all, the property of an electric circuit that at each point the same number of electrons leave the unit per unit of time (this also applies to the liquid!). The moving electrons always generate the same magnetic field strength with their aligned magnetic dipoles.
In short, yes, moving electrons in a vacuum tube generate - because of the common alignment of their magnetic dipoles - a common magnetic field.
